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
|
||||
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 });
|
||||
}
|
||||
} else {
|
||||
this.$store.dispatch('hideReportDetails');
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ export const initialState = {
|
||||
},
|
||||
reportDetails: {
|
||||
id: null,
|
||||
previousId: null,
|
||||
userAsked: null,
|
||||
},
|
||||
reports: [],
|
||||
@ -192,6 +193,11 @@ export const mutations = {
|
||||
state.settings[setting] = value;
|
||||
},
|
||||
[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, 'userAsked', userAsked);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user