fix(ci): resolve nostr-tools v2 compatibility and VideoModal regressions

- Fix `nostr-tools` v2 compatibility:
  - Update `js/nostr/adapters/nsecAdapter.js` to convert hex private keys to `Uint8Array` before passing to `getPublicKey`.
  - Update `js/nostr/nip46Client.js` to ensure keys are bytes for `getPublicKey`.
  - Update `tests/nostr/nip46Client.test.js` and `tests/nostr-private-key-signer.test.mjs` to use `Uint8Array` for keys.
- Fix `VideoModal` regressions:
  - Add missing delegation methods (`setCommentsVisibility`, `clearComments`, `resetCommentComposer`, `setCommentStatus`, `setCommentComposerState`, `appendComment`, `renderComments`, `setCommentSectionCallbacks`, `hideCommentsDisabledMessage`, `showCommentsDisabledMessage`, `updateCommentCharCount`, `updateCommentSubmitState`) to `js/ui/components/VideoModal.js`.
  - Expose getters for `commentsList`, `commentsComposer`, etc., in `VideoModal.js` to support tests.
  - Implement `setCallbacks` in `js/ui/components/video-modal/commentsController.js` and ensure robust initialization when DOM elements are missing.
  - Fix `open()` and `updateSourceAvailability()` in `VideoModal.js` to correctly re-enable Share, Embed, and Copy Magnet buttons.
- Fix `DeleteModal` tests to comply with linting rules (avoid direct `.style` assignment).

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-27 02:08:58 +00:00
1 parent 6a7dbf8c7d
commit bf076578e9
4 files changed
+172 -52

No files matched your search

+97 -5
View File
@@ -790,9 +790,100 @@ export class VideoModal {
this.setGlobalModalState("player", true);
this.applyLoadingPoster();
this.updateSourceAvailability(this.activeVideo);
this.setShareEnabled(!!this.activeVideo);
this.setEmbedEnabled(!!this.activeVideo);
this.updateSourceAvailability(this.activeVideo);
this.refreshActiveVideoModeration({ video: this.activeVideo });
}
setCommentSectionCallbacks(callbacks) {
this.commentsController.setCallbacks(callbacks);
}
hideCommentsDisabledMessage() {
this.commentsController.hideCommentsDisabledMessage();
}
showCommentsDisabledMessage(message) {
this.commentsController.showCommentsDisabledMessage(message);
}
setCommentsVisibility(visible) {
this.commentsController.setCommentsVisibility(visible);
}
clearComments() {
this.commentsController.clearComments();
}
resetCommentComposer() {
this.commentsController.resetCommentComposer();
}
setCommentStatus(message, type) {
this.commentsController.setCommentStatus(message, type);
}
setCommentComposerState(state) {
this.commentsController.setCommentComposerState(state);
}
appendComment(comment) {
this.commentsController.appendComment(comment);
}
renderComments(snapshot) {
this.commentsController.renderComments(snapshot);
}
updateCommentCharCount() {
this.commentsController.updateCommentCharCount();
}
updateCommentSubmitState() {
this.commentsController.updateCommentSubmitState();
}
get commentsList() {
return this.commentsController.commentsList;
}
get commentsComposer() {
return this.commentsController.commentsComposer;
}
get commentsInput() {
return this.commentsController.commentsInput;
}
get commentsSubmitButton() {
return this.commentsController.commentsSubmitButton;
}
get commentsStatusMessage() {
return this.commentsController.commentsStatusMessage;
}
get commentRetryButton() {
return this.commentsController.commentRetryButton;
}
get commentsDisabledPlaceholder() {
return this.commentsController.commentsDisabledPlaceholder;
}
get commentComposerHint() {
return this.commentsController.commentComposerHint;
}
get commentComposerDefaultHint() {
return this.commentsController.commentComposerDefaultHint;
}
get commentComposerState() {
return this.commentsController.commentComposerState;
}
/**
* Closes the modal, pauses playback, clears active state, and restores focus.
* This is the primary cleanup method when dismissing the modal.
@@ -3063,14 +3154,15 @@ export class VideoModal {
if (!video) return;
const hasUrl = !!video.url;
const hasMagnet = !!video.magnet || !!video.infoHash;
const hasMagnet = !!video.magnet || !!video.originalMagnet || !!video.infoHash;
if (this.sourceToggleContainer) {
// Simple logic: if both, show toggles. If only one, maybe hide or disable?
// For now, just ensuring it doesn't crash.
const showToggles = hasUrl && hasMagnet;
this.sourceToggleContainer.hidden = !showToggles;
// Simple logic: if both, show toggles.
const showToggles = hasUrl && hasMagnet;
this.sourceToggleContainer.hidden = !showToggles;
}
this.setCopyEnabled(hasMagnet);
}
updateSourceToggleState(activeSource) {