Skip to content

Commit

Permalink
fix: note comparison in template
Browse files Browse the repository at this point in the history
  • Loading branch information
moughxyz committed Apr 21, 2020
1 parent 35434f8 commit 9023f76
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 42 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/directives/views/accountMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ class AccountMenuCtrl extends PureViewCtrl {
}

async openPrivilegesModal() {
this.close();
const run = () => {
this.application!.presentPrivilegesManagementModal();
this.close();
};
const needsPrivilege = await this.application!.privilegesService!.actionRequiresPrivilege(
ProtectedAction.ManagePrivileges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,18 @@ class RevisionPreviewModalCtrl implements RevisionPreviewScope {

restore(asCopy: boolean) {
const run = async () => {
let item;
if (asCopy) {
const contentCopy = Object.assign({}, this.content);
if (contentCopy.title) {
contentCopy.title += " (copy)";
}
item = await this.application.createManagedItem(
await this.application.createManagedItem(
ContentType.Note,
contentCopy,
true
);
} else {
const uuid = this.uuid;
item = this.application.findItem(uuid)!;
this.application.changeAndSaveItem(item.uuid, (mutator) => {
this.application.changeAndSaveItem(this.uuid, (mutator) => {
mutator.setContent(this.content);
}, true, PayloadSource.RemoteActionRetrieved);
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/views/notes/notes-view.pug
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
)
.note(
ng-repeat='note in self.state.renderedNotes track by note.uuid'
ng-class="{'selected' : self.activeEditorNote == note}"
ng-class="{'selected' : self.activeEditorNote.uuid == note.uuid}"
ng-click='self.selectNote(note)'
)
.note-flags(ng-show='self.noteFlags[note.uuid].length > 0')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import { SNComponent, LiveItem } from 'snjs';
import { WebDirective } from './../../types';
export declare type ComponentModalScope = {
componentUuid: string;
callback: () => void;
onDismiss: (component: SNComponent) => void;
onDismiss: () => void;
application: WebApplication;
};
export declare class ComponentModalCtrl implements ComponentModalScope {
$element: JQLite;
componentUuid: string;
callback: () => void;
onDismiss: (component: SNComponent) => void;
onDismiss: () => void;
application: WebApplication;
liveComponent: LiveItem<SNComponent>;
component: SNComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export { AccountMenu } from './accountMenu';
export { ActionsMenu } from './actionsMenu';
export { ChallengeModal } from './challengeModal';
export { ComponentModal } from './componentModal';
export { ComponentView } from './componentView';
export { EditorMenu } from './editorMenu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { WebApplication } from '@/ui_models/application';
import { ApplicationService, WebPrefKey } from 'snjs';
export declare class PreferencesManager extends ApplicationService {
private userPreferences;
private loadingPrefs;
/** @override */
onAppLaunch(): Promise<void>;
get webApplication(): WebApplication;
streamPreferences(): void;
loadSingleton(): Promise<void>;
preferencesDidChange(): void;
private loadSingleton;
syncUserPreferences(): void;
getValue(key: WebPrefKey, defaultValue?: any): any;
setUserPrefValue(key: WebPrefKey, value: any, sync?: boolean): Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion dist/@types/app/assets/javascripts/ui_models/editor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ export declare class Editor {
private removeStreamObserver;
isTemplateNote: boolean;
constructor(application: WebApplication, noteUuid?: string, noteTitle?: string);
deinit(): void;
private handleNoteStream;
insertTemplatedNote(): Promise<import("../../../../../snjs/dist/@types").SNItem>;
/**
* Reverts the editor to a blank state, removing any existing note from view,
* and creating a placeholder note.
*/
reset(noteTitle?: string): Promise<void>;
deinit(): void;
/**
* Register to be notified when the editor's note changes.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export declare class EditorGroup {
/**
* Notifies observer when the active editor has changed.
*/
addChangeObserver(callback: EditorGroupChangeCallback): void;
addChangeObserver(callback: EditorGroupChangeCallback): () => void;
private notifyObservers;
}
export {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { WebDirective } from '@/types';
export declare class ChallengeModal extends WebDirective {
constructor();
}
1 change: 1 addition & 0 deletions dist/@types/app/assets/javascripts/views/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export { EditorView } from './editor/editor_view';
export { FooterView } from './footer/footer_view';
export { NotesView } from './notes/notes_view';
export { TagsView } from './tags/tags_view';
export { ChallengeModal } from './challenge_modal/challenge_modal';
11 changes: 6 additions & 5 deletions dist/@types/app/assets/javascripts/views/notes/note_utils.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { SNNote, SNTag } from 'snjs';
export declare enum NoteSortKey {
CreatedAt = "created_at",
UserUpdatedAt = "userModifiedDate",
Title = "title",
/** @legacy Use UserUpdatedAt instead */
UpdatedAt = "updated_at",
ClientUpdatedAt = "client_updated_at",
Title = "title"
/** @legacy Use UserUpdatedAt instead */
ClientUpdatedAt = "client_updated_at"
}
export declare function filterAndSortNotes(notes: SNNote[], selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string, sortBy: string, reverse: boolean): SNNote[];
export declare function filterNotes(notes: SNNote[], selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string): SNNote[];
export declare function sortNotes(notes: SNNote[] | undefined, sortBy: string, reverse: boolean): SNNote[];
export declare function notePassesFilter(note: SNNote, selectedTag: SNTag, showArchived: boolean, hidePinned: boolean, filterText: string): boolean;
Loading

0 comments on commit 9023f76

Please sign in to comment.