Merges master
This commit is contained in:
@@ -39,7 +39,7 @@ class LockScreenCtrl extends PureCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
async submitPasscodeForm($event) {
|
||||
async submitPasscodeForm() {
|
||||
if (
|
||||
!this.formData.passcode ||
|
||||
this.formData.passcode.length === 0
|
||||
@@ -78,4 +78,4 @@ export class LockScreen {
|
||||
puppet: '='
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,8 +133,7 @@ class NotesCtrl extends PureCtrl {
|
||||
const selectedNote = this.state.selectedNote;
|
||||
if (selectedNote) {
|
||||
const discarded = selectedNote.deleted || selectedNote.content.trashed;
|
||||
const notIncluded = !this.state.notes.includes(selectedNote);
|
||||
if (notIncluded || discarded) {
|
||||
if (discarded) {
|
||||
this.selectNextOrCreateNew();
|
||||
}
|
||||
} else {
|
||||
@@ -165,7 +164,7 @@ class NotesCtrl extends PureCtrl {
|
||||
});
|
||||
this.resetScrollPosition();
|
||||
this.setShowMenuFalse();
|
||||
this.setNoteFilterText('');
|
||||
await this.setNoteFilterText('');
|
||||
this.desktopManager.searchText();
|
||||
this.resetPagination();
|
||||
|
||||
@@ -193,9 +192,9 @@ class NotesCtrl extends PureCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @template
|
||||
* @internal
|
||||
* @internal
|
||||
*/
|
||||
async selectNote(note) {
|
||||
this.appState.setSelectedNote(note);
|
||||
@@ -219,7 +218,7 @@ class NotesCtrl extends PureCtrl {
|
||||
selectedTag: this.state.tag,
|
||||
showArchived: this.state.showArchived,
|
||||
hidePinned: this.state.hidePinned,
|
||||
filterText: this.state.noteFilter.text,
|
||||
filterText: this.state.noteFilter.text.toLowerCase(),
|
||||
sortBy: this.state.sortBy,
|
||||
reverse: this.state.sortReverse
|
||||
});
|
||||
@@ -514,10 +513,16 @@ class NotesCtrl extends PureCtrl {
|
||||
if (!selectedTag) {
|
||||
throw 'Attempting to create note with no selected tag';
|
||||
}
|
||||
if (this.state.selectedNote && this.state.selectedNote.dummy) {
|
||||
let title;
|
||||
let isDummyNote = true;
|
||||
if (this.isFiltering()) {
|
||||
title = this.state.noteFilter.text;
|
||||
isDummyNote = false;
|
||||
} else if (this.state.selectedNote && this.state.selectedNote.dummy) {
|
||||
return;
|
||||
} else {
|
||||
title = `Note ${this.state.notes.length + 1}`;
|
||||
}
|
||||
const title = "Note" + (this.state.notes ? (" " + (this.state.notes.length + 1)) : "");
|
||||
const newNote = await this.application.createItem({
|
||||
contentType: ContentTypes.Note,
|
||||
content: {
|
||||
@@ -527,7 +532,7 @@ class NotesCtrl extends PureCtrl {
|
||||
add: true
|
||||
});
|
||||
newNote.client_updated_at = new Date();
|
||||
newNote.dummy = true;
|
||||
newNote.dummy = isDummyNote;
|
||||
this.application.setItemNeedsSync({ item: newNote });
|
||||
if (!selectedTag.isSmartTag()) {
|
||||
selectedTag.addItemAsRelationship(newNote);
|
||||
@@ -562,9 +567,6 @@ class NotesCtrl extends PureCtrl {
|
||||
this.searchSubmitted = false;
|
||||
}
|
||||
await this.reloadNotes();
|
||||
if (!this.state.notes.includes(this.state.selectedNote)) {
|
||||
this.selectFirstNote();
|
||||
}
|
||||
}
|
||||
|
||||
onFilterEnter() {
|
||||
|
||||
@@ -254,40 +254,29 @@ class RootCtrl extends PureCtrl {
|
||||
}, false);
|
||||
}
|
||||
|
||||
handleAutoSignInFromParams() {
|
||||
const urlParam = (key) => {
|
||||
return this.$location.search()[key];
|
||||
};
|
||||
async handleAutoSignInFromParams() {
|
||||
const params = this.$location.search();
|
||||
const server = params.server;
|
||||
const email = params.email;
|
||||
const password = params.pw;
|
||||
if (!server || !email || !password) return;
|
||||
|
||||
const autoSignInFromParams = async () => {
|
||||
const server = urlParam('server');
|
||||
const email = urlParam('email');
|
||||
const pw = urlParam('pw');
|
||||
if (!this.application.getUser()) {
|
||||
if (
|
||||
await this.application.getHost() === server
|
||||
&& this.application.getUser().email === email
|
||||
) {
|
||||
/** Already signed in, return */
|
||||
// eslint-disable-next-line no-useless-return
|
||||
return;
|
||||
} else {
|
||||
/** Sign out */
|
||||
await this.application.signOut();
|
||||
await this.application.restart();
|
||||
}
|
||||
const user = this.application.getUser();
|
||||
if (user) {
|
||||
if (user.email === email && await this.application.getHost() === server) {
|
||||
/** Already signed in, return */
|
||||
return;
|
||||
} else {
|
||||
await this.application.setHost(server);
|
||||
this.application.signIn({
|
||||
email: email,
|
||||
password: pw,
|
||||
});
|
||||
/** Sign out */
|
||||
await this.application.signOut();
|
||||
await this.application.restart();
|
||||
}
|
||||
};
|
||||
|
||||
if (urlParam('server')) {
|
||||
autoSignInFromParams();
|
||||
}
|
||||
await this.application.setHost(server);
|
||||
this.application.signIn({
|
||||
email: email,
|
||||
password: password,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ class AccountMenuCtrl extends PureCtrl {
|
||||
}
|
||||
await this.setFormDataState({
|
||||
status: null,
|
||||
user_password: null
|
||||
});
|
||||
const error = response
|
||||
? response.error
|
||||
@@ -462,6 +463,19 @@ class AccountMenuCtrl extends PureCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
hidePasswordForm() {
|
||||
this.setFormDataState({
|
||||
showLogin: false,
|
||||
showRegister: false,
|
||||
user_password: null,
|
||||
password_conf: null
|
||||
});
|
||||
}
|
||||
|
||||
hasPasscode() {
|
||||
return this.passcodeManager.hasPasscode();
|
||||
}
|
||||
|
||||
addPasscodeClicked() {
|
||||
this.setFormDataState({
|
||||
showPasscodeForm: true
|
||||
|
||||
@@ -42,7 +42,7 @@ class EditorMenuCtrl extends PureCtrl {
|
||||
}
|
||||
|
||||
toggleDefaultForEditor(editor) {
|
||||
if(this.defaultEditor === editor) {
|
||||
if(this.state.defaultEditor === editor) {
|
||||
this.removeEditorDefault(editor);
|
||||
} else {
|
||||
this.makeEditorDefault(editor);
|
||||
|
||||
Reference in New Issue
Block a user