Merge branch 'release/3.6.0' into develop
This commit is contained in:
@@ -148,9 +148,7 @@ class AccountMenuCtrl extends PureViewCtrl<unknown, AccountMenuState> {
|
||||
async $onInit() {
|
||||
super.$onInit();
|
||||
this.setState({
|
||||
showSessions:
|
||||
this.appState.enableUnfinishedFeatures &&
|
||||
(await this.application.userCanManageSessions()),
|
||||
showSessions: await this.application.userCanManageSessions()
|
||||
});
|
||||
|
||||
const sync = this.appState.sync;
|
||||
|
||||
@@ -124,4 +124,6 @@ export const Strings = {
|
||||
: 'password manager';
|
||||
return `Your keys are currently stored in your operating system's ${keychainName}. Adding a passcode prevents even your operating system from reading them.`;
|
||||
},
|
||||
protectingNoteWithoutProtectionSources: 'Access to this note will not be restricted until you set up a passcode or account.',
|
||||
openAccountMenu: 'Open Account Menu'
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { STRING_ARCHIVE_LOCKED_ATTEMPT, STRING_SAVING_WHILE_DOCUMENT_HIDDEN, STRING_UNARCHIVE_LOCKED_ATTEMPT } from './../../strings';
|
||||
import { Strings, STRING_ARCHIVE_LOCKED_ATTEMPT, STRING_SAVING_WHILE_DOCUMENT_HIDDEN, STRING_UNARCHIVE_LOCKED_ATTEMPT } from './../../strings';
|
||||
import { Editor } from '@/ui_models/editor';
|
||||
import { WebApplication } from '@/ui_models/application';
|
||||
import { PanelPuppet, WebDirective } from '@/types';
|
||||
@@ -713,15 +713,21 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
|
||||
);
|
||||
}
|
||||
|
||||
toggleProtectNote() {
|
||||
this.saveNote(
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
(mutator) => {
|
||||
mutator.protected = !this.note.protected;
|
||||
async toggleProtectNote() {
|
||||
if (this.note.protected) {
|
||||
void this.application.unprotectNote(this.note);
|
||||
} else {
|
||||
const note = await this.application.protectNote(this.note);
|
||||
if (note?.protected && !this.application.hasProtectionSources()) {
|
||||
if (await confirmDialog({
|
||||
text: Strings.protectingNoteWithoutProtectionSources,
|
||||
confirmButtonText: Strings.openAccountMenu,
|
||||
confirmButtonStyle: 'info',
|
||||
})) {
|
||||
this.appState.accountMenu.setShow(true);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
toggleNotePreview() {
|
||||
|
||||
@@ -5,44 +5,54 @@ export function notePassesFilter(
|
||||
showArchived: boolean,
|
||||
hidePinned: boolean,
|
||||
filterText: string
|
||||
) {
|
||||
|
||||
): boolean {
|
||||
const canShowArchived = showArchived;
|
||||
const canShowPinned = !hidePinned;
|
||||
if (
|
||||
(note.archived && !canShowArchived) ||
|
||||
(note.pinned && !canShowPinned)
|
||||
) {
|
||||
if ((note.archived && !canShowArchived) || (note.pinned && !canShowPinned)) {
|
||||
return false;
|
||||
}
|
||||
return noteMatchesQuery(note, filterText);
|
||||
if (note.protected) {
|
||||
const match = noteMatchesQuery(note, filterText);
|
||||
/** Only match title to prevent leaking protected note text */
|
||||
return match === Match.Title || match === Match.TitleAndText;
|
||||
} else {
|
||||
return noteMatchesQuery(note, filterText) !== Match.None;
|
||||
}
|
||||
}
|
||||
|
||||
function noteMatchesQuery(
|
||||
note: SNNote,
|
||||
query: string
|
||||
) {
|
||||
enum Match {
|
||||
None = 0,
|
||||
Title = 1,
|
||||
Text = 2,
|
||||
TitleAndText = Title + Text,
|
||||
Uuid = 5,
|
||||
}
|
||||
|
||||
function noteMatchesQuery(note: SNNote, query: string): Match {
|
||||
if (query.length === 0) {
|
||||
return true;
|
||||
return Match.TitleAndText;
|
||||
}
|
||||
const title = note.safeTitle().toLowerCase();
|
||||
const text = note.safeText().toLowerCase();
|
||||
const lowercaseText = query.toLowerCase();
|
||||
const words = lowercaseText.split(' ');
|
||||
const quotedText = stringBetweenQuotes(lowercaseText);
|
||||
if (quotedText) {
|
||||
return title.includes(quotedText) || text.includes(quotedText);
|
||||
return (
|
||||
(title.includes(quotedText) ? Match.Title : Match.None) +
|
||||
(text.includes(quotedText) ? Match.Text : Match.None)
|
||||
);
|
||||
}
|
||||
if (stringIsUuid(lowercaseText)) {
|
||||
return note.uuid === lowercaseText;
|
||||
return note.uuid === lowercaseText ? Match.Uuid : Match.None;
|
||||
}
|
||||
const words = lowercaseText.split(" ");
|
||||
const matchesTitle = words.every((word) => {
|
||||
return title.indexOf(word) >= 0;
|
||||
});
|
||||
const matchesBody = words.every((word) => {
|
||||
return text.indexOf(word) >= 0;
|
||||
});
|
||||
return matchesTitle || matchesBody;
|
||||
return (matchesTitle ? Match.Title : 0) + (matchesBody ? Match.Text : 0);
|
||||
}
|
||||
|
||||
function stringBetweenQuotes(text: string) {
|
||||
|
||||
@@ -143,10 +143,12 @@
|
||||
.default-preview(
|
||||
ng-show='!note.preview_html && !note.preview_plain'
|
||||
) {{note.text}}
|
||||
.date.faded(ng-show='!self.state.hideDate')
|
||||
span(ng-show="self.state.sortBy == 'userModifiedDate'")
|
||||
.bottom-info.faded(ng-show='!self.state.hideDate || note.protected')
|
||||
span(ng-if="note.protected")
|
||||
| Protected{{self.state.hideDate ? '' : ' • '}}
|
||||
span(ng-show="!self.state.hideDate && self.state.sortBy == 'userModifiedDate'")
|
||||
| Modified {{note.updatedAtString || 'Now'}}
|
||||
span(ng-show="self.state.sortBy != 'userModifiedDate'")
|
||||
span(ng-show="!self.state.hideDate && self.state.sortBy != 'userModifiedDate'")
|
||||
| {{note.createdAtString || 'Now'}}
|
||||
.tags-string(ng-if='!self.state.hideTags && self.state.renderedNotesTags[$index]')
|
||||
.faded {{self.state.renderedNotesTags[$index]}}
|
||||
|
||||
@@ -576,12 +576,6 @@ class NotesViewCtrl extends PureViewCtrl<unknown, NotesState> {
|
||||
class: 'warning'
|
||||
});
|
||||
}
|
||||
if (note.protected) {
|
||||
flags.push({
|
||||
text: "Protected",
|
||||
class: 'success'
|
||||
});
|
||||
}
|
||||
if (note.locked) {
|
||||
flags.push({
|
||||
text: "Locked",
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
> .date {
|
||||
> .bottom-info {
|
||||
font-size: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,6 @@
|
||||
) Change Password
|
||||
a.sk-a.info.sk-panel-row.condensed(
|
||||
ng-click="self.openSessionsModal()"
|
||||
ng-if="self.state.showSessions"
|
||||
) Manage Sessions
|
||||
.sk-panel-section
|
||||
.sk-panel-section-title Encryption
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "standard-notes-web",
|
||||
"version": "3.5.19",
|
||||
"version": "3.6.0-beta01",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
Reference in New Issue
Block a user