Skip to content

Commit

Permalink
use lazy title loading in bookmarks buttons to have decrypted title u…
Browse files Browse the repository at this point in the history
…pon protected session start, #2393
  • Loading branch information
zadam committed Dec 19, 2021
1 parent 1aff42f commit e29aee1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/public/app/widgets/buttons/button_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export default class ButtonWidget extends NoteContextAwareWidget {
this.$widget.tooltip({
html: true,
title: () => {
const title = this.settings.title;
const title = typeof this.settings.title === "function"
? this.settings.title()
: this.settings.title;

const action = actions.find(act => act.actionName === this.settings.command);

if (action && action.effectiveShortcuts.length > 0) {
Expand Down
7 changes: 6 additions & 1 deletion src/public/app/widgets/buttons/open_note_button_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ export default class OpenNoteButtonWidget extends ButtonWidget {
}

this.icon(note.getIcon());
this.title(note.title);
this.title(() => {
const n = froca.getNoteFromCache(noteId);

// always fresh, always decoded (when protected session is available)
return n.title;
});

this.refreshIcon();
});
Expand Down

0 comments on commit e29aee1

Please sign in to comment.