Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <ClemMakesApps@gmail.com>2017-05-05 21:23:31 +0300
committerClement Ho <ClemMakesApps@gmail.com>2017-05-05 21:23:31 +0300
commit48e4991907aa9046c25323af53afc3b7eaa895c4 (patch)
treeda2fc72eeb92f3b4a94d4a64062f32c796f82228 /app/assets/javascripts/sidebar/components/time_tracking
parent933447e0da19f9d0be8574185500cabb5d7ab012 (diff)
Add sidebar specs
Diffstat (limited to 'app/assets/javascripts/sidebar/components/time_tracking')
-rw-r--r--app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.js b/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.js
index e2dba1fb0c2..244b67b3ad9 100644
--- a/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.js
+++ b/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.js
@@ -17,15 +17,21 @@ export default {
},
methods: {
listenForSlashCommands() {
- $(document).on('ajax:success', '.gfm-form', (e, data) => {
- const subscribedCommands = ['spend_time', 'time_estimate'];
- const changedCommands = data.commands_changes
+ $(document).on('ajax:success', '.gfm-form', this.slashCommandListened);
+ },
+ slashCommandListened(e, data) {
+ const subscribedCommands = ['spend_time', 'time_estimate'];
+ let changedCommands;
+ if (data !== undefined) {
+ changedCommands = data.commands_changes
? Object.keys(data.commands_changes)
: [];
- if (changedCommands && _.intersection(subscribedCommands, changedCommands).length) {
- this.mediator.fetch();
- }
- });
+ } else {
+ changedCommands = [];
+ }
+ if (changedCommands && _.intersection(subscribedCommands, changedCommands).length) {
+ this.mediator.fetch();
+ }
},
},
mounted() {