* Removed hard refresh

* Changed sorting to happen during compute
This commit is contained in:
Keith Holliday
2017-10-23 17:27:26 -05:00
committed by GitHub
parent 7fe2504906
commit 4d32977e5c
2 changed files with 32 additions and 27 deletions

View File

@@ -214,19 +214,19 @@ export default {
}
// Verify the client is updated
const serverAppVersion = response.data.appVersion;
let serverAppVersionState = this.$store.state.serverAppVersion;
let deniedUpdate = this.$store.state.deniedUpdate;
if (isApiCall && !serverAppVersionState) {
this.$store.state.serverAppVersion = serverAppVersion;
} else if (isApiCall && serverAppVersionState !== serverAppVersion && !deniedUpdate || isCron) {
// For reload on cron
if (isCron || confirm(this.$t('habiticaHasUpdated'))) {
location.reload(true);
} else {
this.$store.state.deniedUpdate = true;
}
}
// const serverAppVersion = response.data.appVersion;
// let serverAppVersionState = this.$store.state.serverAppVersion;
// let deniedUpdate = this.$store.state.deniedUpdate;
// if (isApiCall && !serverAppVersionState) {
// this.$store.state.serverAppVersion = serverAppVersion;
// } else if (isApiCall && serverAppVersionState !== serverAppVersion && !deniedUpdate || isCron) {
// // For reload on cron
// if (isCron || confirm(this.$t('habiticaHasUpdated'))) {
// location.reload(true);
// } else {
// this.$store.state.deniedUpdate = true;
// }
// }
return response;
});

View File

@@ -297,8 +297,25 @@ export default {
}),
taskList () {
// @TODO: This should not default to user's tasks. It should require that you pass options in
if (this.taskListOverride) return this.taskListOverride;
return this.tasks[`${this.type}s`];
const filter = this.activeFilters[this.type];
let taskList = this.tasks[`${this.type}s`];
if (this.taskListOverride) taskList = this.taskListOverride;
if (taskList.length > 0 && ['scheduled', 'due'].indexOf(filter.label) === -1) {
let taskListSorted = this.$store.dispatch('tasks:order', [
taskList,
this.user.tasksOrder,
]);
taskList = taskListSorted[`${this.type}s`];
}
if (filter.sort) {
taskList = sortBy(taskList, filter.sort);
}
return taskList;
},
inAppRewards () {
let watchRefresh = this.forceRefresh; // eslint-disable-line
@@ -408,18 +425,6 @@ export default {
this.loadCompletedTodos();
}
this.activeFilters[type] = filter;
if (['scheduled', 'due'].indexOf(filter.label) === -1) {
let sortedTasks = this.$store.dispatch('tasks:order', [
this.tasks[`${type}s`],
this.user.tasksOrder,
]);
this.tasks[`${type}s`] = sortedTasks[`${type}s`];
}
if (filter.sort) {
this.tasks[`${type}s`] = sortBy(this.tasks[`${type}s`], filter.sort);
}
},
setColumnBackgroundVisibility () {
this.$nextTick(() => {