Prevents user prefs saving when changing to view modes that do not use fetchonly

This commit is contained in:
Mateus Machado Luna 2018-09-06 10:37:52 -03:00
parent 443a65064b
commit fa40ac7418
2 changed files with 17 additions and 15 deletions

View File

@ -943,15 +943,15 @@
else if (metadatum.display == 'yes')
display = true;
// // Deciding display based on user prefs
// if (prefsFetchOnlyObject != undefined &&
// prefsFetchOnlyObject.meta != undefined) {
// let index = prefsFetchOnlyObject.meta.findIndex(metadatumId => metadatumId == metadatum.id);
// if (index >= 0)
// display = true;
// else
// display = false;
// }
// Deciding display based on user prefs
if (prefsFetchOnlyObject != undefined &&
prefsFetchOnlyObject.meta != undefined) {
let index = prefsFetchOnlyObject.meta.findIndex(metadatumId => metadatumId == metadatum.id);
if (index >= 0)
display = true;
else
display = false;
}
metadata.push({
name: metadatum.name,
@ -1045,7 +1045,7 @@
'2': 'author_name',
'3': 'title',
'4': 'description'
});
}, true);
this.sortingMetadata.push({
name: this.$i18n.get('label_title'),

View File

@ -189,14 +189,16 @@ export default {
this.$store.dispatch('search/add_fetchonly_meta', metadatum );
this.updateURLQueries();
},
addFetchOnly( metadatum ){
addFetchOnly( metadatum, ignorePrefs ){
this.$store.dispatch('search/add_fetchonly', metadatum );
this.updateURLQueries();
let prefsFetchOnly = this.collectionId != undefined ? 'fetch_only_' + this.collectionId : 'fetch_only';
if (JSON.stringify(this.$userPrefs.get(prefsFetchOnly)) != JSON.stringify(metadatum)) {
this.$userPrefs.set(prefsFetchOnly, metadatum)
.catch(() => { this.$console.log("Error setting user prefs for fetch_only"); });
if (!ignorePrefs) {
let prefsFetchOnly = this.collectionId != undefined ? 'fetch_only_' + this.collectionId : 'fetch_only';
if (JSON.stringify(this.$userPrefs.get(prefsFetchOnly)) != JSON.stringify(metadatum)) {
this.$userPrefs.set(prefsFetchOnly, metadatum)
.catch(() => { this.$console.log("Error setting user prefs for fetch_only"); });
}
}
},
cleanFetchOnly() {