Skip to content

Commit

Permalink
Merge pull request #15923 from ahmedhamidawan/history_view_switching_bug
Browse files Browse the repository at this point in the history
[23.0] Fix History Import Bugs
  • Loading branch information
dannon authored Apr 17, 2023
2 parents 298a96d + c43fef9 commit dad83ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion client/src/components/providers/UserHistories.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export default {
return null;
},
historyModels() {
return this.histories.map((h) => Object.assign({}, h));
return this.histories
.map((h) => Object.assign({}, h))
.filter((h) => !h.user_id || h.user_id === this.user.id);
},
},
methods: {
Expand Down
4 changes: 2 additions & 2 deletions client/src/store/historyStore/historyStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
const state = {
// selected history
currentHistoryId: null,
// histories for current user
// histories for current user, can also have other user histories loaded for HistoryView
histories: {},
historiesLoading: false,
};
Expand Down Expand Up @@ -98,7 +98,7 @@ let isLoadingHistories = false;
const actions = {
async copyHistory({ dispatch }, { history, name, copyAll }) {
const newHistory = await cloneHistory(history, name, copyAll);
return dispatch("selectHistory", newHistory);
return dispatch("setCurrentHistory", newHistory.id);
},
async createNewHistory({ dispatch }) {
// create history, then select it as current at the same time
Expand Down

0 comments on commit dad83ff

Please sign in to comment.