Prevent dismissed report details from immediately reopening
This commit is contained in:
parent
aaa8998466
commit
42779844a7
@ -493,7 +493,10 @@ export default {
|
|||||||
);
|
);
|
||||||
// TODO: Take into account the history of positions for the direction
|
// TODO: Take into account the history of positions for the direction
|
||||||
if (closestReport.id !== -1) {
|
if (closestReport.id !== -1) {
|
||||||
|
// Only open the details if the box was not just closed
|
||||||
|
if (this.$store.state.reportDetails.previousId !== closestReport.id) {
|
||||||
this.$store.dispatch('showReportDetails', { id: closestReport.id, userAsked: false });
|
this.$store.dispatch('showReportDetails', { id: closestReport.id, userAsked: false });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch('hideReportDetails');
|
this.$store.dispatch('hideReportDetails');
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,7 @@ export const initialState = {
|
|||||||
},
|
},
|
||||||
reportDetails: {
|
reportDetails: {
|
||||||
id: null,
|
id: null,
|
||||||
|
previousId: null,
|
||||||
userAsked: null,
|
userAsked: null,
|
||||||
},
|
},
|
||||||
reports: [],
|
reports: [],
|
||||||
@ -192,6 +193,11 @@ export const mutations = {
|
|||||||
state.settings[setting] = value;
|
state.settings[setting] = value;
|
||||||
},
|
},
|
||||||
[types.SHOW_REPORT_DETAILS](state, { id, userAsked }) {
|
[types.SHOW_REPORT_DETAILS](state, { id, userAsked }) {
|
||||||
|
if (id === null) {
|
||||||
|
// If closing the details, keep track of what the id was to prevent
|
||||||
|
// reopening the details immediately.
|
||||||
|
Vue.set(state.reportDetails, 'previousId', state.reportDetails.id);
|
||||||
|
}
|
||||||
Vue.set(state.reportDetails, 'id', id);
|
Vue.set(state.reportDetails, 'id', id);
|
||||||
Vue.set(state.reportDetails, 'userAsked', userAsked);
|
Vue.set(state.reportDetails, 'userAsked', userAsked);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user