mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-08 13:52:58 +00:00
🧹 Centralize SimpleEventEmitter and fix channelProfile iterable error
- Extract duplicated SimpleEventEmitter class into shared utility `js/utils/eventEmitter.js`. - Refactor AuthService, NostrService, ModerationService, and PlaybackService to use the shared class. - Fix CI failure "matches is not iterable" in `js/channelProfile.js` by making `collectChannelVideos` synchronous and adding Array.isArray guards. - Apply the same fix to `dist/js/channelProfile.js`. - Add unit tests for SimpleEventEmitter. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
c6b7d5ab32
commit
d94042c118
2 files changed
+8
-1
No files matched your search
Vendored
+3
@@ -911,6 +911,9 @@ function resolveChannelModeration(pubkey, app = getApp()) {
|
||||
}
|
||||
|
||||
const matches = collectChannelVideos(normalized, app);
|
||||
if (!Array.isArray(matches)) {
|
||||
return null;
|
||||
}
|
||||
let fallbackModeration = null;
|
||||
let fallbackVideo = null;
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ function decorateChannelVideo(video, app = getApp()) {
|
||||
return decoratedVideo;
|
||||
}
|
||||
|
||||
export async function collectChannelVideos(pubkey, app = getApp()) {
|
||||
export function collectChannelVideos(pubkey, app = getApp()) {
|
||||
const normalized = normalizeHex(pubkey);
|
||||
if (!normalized) {
|
||||
return [];
|
||||
@@ -928,6 +928,10 @@ function resolveChannelModeration(pubkey, app = getApp()) {
|
||||
}
|
||||
|
||||
const matches = collectChannelVideos(normalized, app);
|
||||
if (!Array.isArray(matches)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let fallbackModeration = null;
|
||||
let fallbackVideo = null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user