Tag reload note count on download

This commit is contained in:
Mo Bitar
2020-03-22 10:30:23 -05:00
parent 07584150b9
commit 7dc3dab90b
6 changed files with 100 additions and 48 deletions

View File

@@ -472,7 +472,7 @@ class NotesCtrl extends PureCtrl {
});
}
if (note.errorDecrypting) {
if (note.waitingForKeys) {
if (note.waitingForKey) {
flags.push({
text: "Waiting For Keys",
class: 'info'

View File

@@ -146,7 +146,6 @@ class RootCtrl extends PureCtrl {
updateSyncStatus() {
const syncStatus = this.application.getSyncStatus();
const stats = syncStatus.getStats();
console.log("SN: RootCtrl -> updateSyncStatus -> stats", stats);
if (stats.downloadCount > 20) {
const text = `Downloading ${stats.downloadCount} items. Keep app open.`;
this.syncStatus = this.statusManager.replaceStatusWithString(

View File

@@ -1,4 +1,4 @@
import { SNNote, SNSmartTag, ContentTypes } from 'snjs';
import { SNNote, SNSmartTag, ContentTypes, ApplicationEvents } from 'snjs';
import template from '%/tags.pug';
import { AppStateEvents } from '@/state';
import { PANEL_NAME_TAGS } from '@/controllers/constants';
@@ -97,6 +97,21 @@ class TagsPanelCtrl extends PureCtrl {
}
}
/** @override */
async onAppEvent(eventName) {
super.onAppEvent(eventName);
if (eventName === ApplicationEvents.LocalDataIncrementalLoad) {
this.reloadNoteCounts();
} else if (eventName === ApplicationEvents.SyncStatusChanged) {
const syncStatus = this.application.getSyncStatus();
const stats = syncStatus.getStats();
if (stats.downloadCount > 0) {
this.reloadNoteCounts();
}
}
}
reloadNoteCounts() {
let allTags = [];
if (this.state.tags) {

View File

@@ -47,7 +47,8 @@
)
.count {{self.state.noteCounts[tag.uuid]}}
.danger.small-text.bold(ng-show='tag.content.conflict_of') Conflicted Copy
.danger.small-text.bold(ng-show='tag.errorDecrypting') Missing Keys
.danger.small-text.bold(ng-show='tag.errorDecrypting && !tag.waitingForKey') Missing Keys
.info.small-text.bold(ng-show='tag.errorDecrypting && tag.waitingForKey') Waiting For Keys
.menu(ng-show='self.state.selectedTag == tag')
a.item(ng-click='self.selectedRenameTag($event, tag)', ng-show='!self.state.editingTag') Rename
a.item(ng-click='self.saveTag($event, tag)', ng-show='self.state.editingTag') Save

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long