mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-11 15:22:34 +00:00
Fix CI, environment, linting, and unit test issues
- Fix circular dependency in `js/adminListStore.js` by importing from `js/nostrClientRegistry.js`. - Update `js/services/hashtagPreferencesService.js` to include legacy kind 30005 in filters. - Fix JSDOM mocking in `tests/modal-accessibility.test.mjs` (navigator getter) and `UploadModal` selectors. - Add `getRoot()` to `js/ui/components/UploadModal.js` for API consistency. - Update `tests/magnet-utils.test.mjs` expectations to reflect removed default tracker. - Mock `ensureActiveSignerForPubkey` in `tests/moderation/submit-report.test.mjs`. - Fix mock loader path in `tests/moderation/trust-seeds.test.mjs` to target `trustBootstrap.js`. - Fix duplicate pointer tags in `js/nostrEventSchemas.js`'s `buildCommentEvent`. - Update `tests/nostr/comment-events.test.mjs` and `tests/comment-event-builder.test.mjs` to match current code behavior (legacy kinds, unique tags).
This commit is contained in:
1 parent
778b35874d
commit
d6882fb5bb
12 files changed
+331
-235
No files matched your search
@@ -378,8 +378,15 @@ class HashtagPreferencesService {
|
||||
|
||||
const schema = getNostrEventSchema(NOTE_TYPES.HASHTAG_PREFERENCES);
|
||||
const canonicalKind = schema?.kind ?? 30015;
|
||||
const legacyKind = 30005;
|
||||
|
||||
const kinds = [canonicalKind];
|
||||
if (canonicalKind !== legacyKind) {
|
||||
kinds.push(legacyKind);
|
||||
}
|
||||
|
||||
const filter = {
|
||||
kinds: [canonicalKind],
|
||||
kinds,
|
||||
authors: [normalized],
|
||||
"#d": [HASHTAG_IDENTIFIER],
|
||||
limit: 50,
|
||||
@@ -415,6 +422,18 @@ class HashtagPreferencesService {
|
||||
const candidateTs = Number(candidate.created_at) || 0;
|
||||
const currentTs = Number(current.created_at) || 0;
|
||||
if (candidateTs === currentTs) {
|
||||
if (
|
||||
candidate.kind === canonicalKind &&
|
||||
current.kind !== canonicalKind
|
||||
) {
|
||||
return candidate;
|
||||
}
|
||||
if (
|
||||
current.kind === canonicalKind &&
|
||||
candidate.kind !== canonicalKind
|
||||
) {
|
||||
return current;
|
||||
}
|
||||
return candidate.id > current.id ? candidate : current;
|
||||
}
|
||||
return candidateTs > currentTs ? candidate : current;
|
||||
|
||||
Reference in new issue
Block a user