summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/diffs/store/actions.js
diff options
context:
space:
mode:
authorDenys Mishunov <dmishunov@gitlab.com>2019-02-27 09:12:13 +0000
committerPhil Hughes <me@iamphill.com>2019-02-27 09:12:13 +0000
commit0aff8e27530d391e4c819838b46d77f6231ecf70 (patch)
tree994b53c9de178e06dfca697044c231651749a369 /app/assets/javascripts/diffs/store/actions.js
parentd40a3809fd387f8dc9a28218a004260b600a1412 (diff)
downloadgitlab-ce-0aff8e27530d391e4c819838b46d77f6231ecf70.tar.gz
Set up basic keyboard next/previous navigation in diff list
Mousetrap is used as the help-tool to listen to keystrokes Added currentDiffIndex getter to store that holds the index of currently active diff file in the list Instead of computing it on the component, we will take advantage of it being available for all components in DiffsApp Testing keyboard navigation and jumpToFile()
Diffstat (limited to 'app/assets/javascripts/diffs/store/actions.js')
-rw-r--r--app/assets/javascripts/diffs/store/actions.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js
index 82ff2e3be76..c40775c3259 100644
--- a/app/assets/javascripts/diffs/store/actions.js
+++ b/app/assets/javascripts/diffs/store/actions.js
@@ -52,7 +52,9 @@ export const fetchDiffFiles = ({ state, commit }) => {
};
export const setHighlightedRow = ({ commit }, lineCode) => {
+ const fileHash = lineCode.split('_')[0];
commit(types.SET_HIGHLIGHTED_ROW, lineCode);
+ commit(types.UPDATE_CURRENT_DIFF_FILE_ID, fileHash);
};
// This is adding line discussions to the actual lines in the diff tree
@@ -262,8 +264,6 @@ export const scrollToFile = ({ state, commit }, path) => {
document.location.hash = fileHash;
commit(types.UPDATE_CURRENT_DIFF_FILE_ID, fileHash);
-
- setTimeout(() => commit(types.UPDATE_CURRENT_DIFF_FILE_ID, ''), 1000);
};
export const toggleShowTreeList = ({ commit, state }) => {