summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/right_sidebar.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/right_sidebar.js')
-rw-r--r--app/assets/javascripts/right_sidebar.js40
1 files changed, 5 insertions, 35 deletions
diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js
index 6cdd89ad431..36f5e6f4ce1 100644
--- a/app/assets/javascripts/right_sidebar.js
+++ b/app/assets/javascripts/right_sidebar.js
@@ -2,8 +2,8 @@
import $ from 'jquery';
import Cookies from 'js-cookie';
-import { fixTitle, hide } from '~/tooltips';
-import { deprecatedCreateFlash as flash } from './flash';
+import { hide } from '~/tooltips';
+import createFlash from './flash';
import axios from './lib/utils/axios_utils';
import { sprintf, s__, __ } from './locale';
@@ -98,45 +98,15 @@ Sidebar.prototype.toggleTodo = function (e) {
this.todoUpdateDone(data);
})
.catch(() =>
- flash(
- sprintf(__('There was an error %{message} todo.'), {
+ createFlash({
+ message: sprintf(__('There was an error %{message} todo.'), {
message:
ajaxType === 'post' ? s__('RightSidebar|adding a') : s__('RightSidebar|deleting the'),
}),
- ),
+ }),
);
};
-Sidebar.prototype.todoUpdateDone = function (data) {
- const deletePath = data.delete_path ? data.delete_path : null;
- const attrPrefix = deletePath ? 'mark' : 'todo';
- const $todoBtns = $('.js-issuable-todo');
-
- $(document).trigger('todo:toggle', data.count);
-
- $todoBtns.each((i, el) => {
- const $el = $(el);
- const $elText = $el.find('.js-issuable-todo-inner');
-
- $el
- .removeClass('is-loading')
- .enable()
- .attr('aria-label', $el.data(`${attrPrefix}Text`))
- .attr('title', $el.data(`${attrPrefix}Text`))
- .data('deletePath', deletePath);
-
- if ($el.hasClass('has-tooltip')) {
- fixTitle(el);
- }
-
- if (typeof $el.data('isCollapsed') !== 'undefined') {
- $elText.html($el.data(`${attrPrefix}Icon`));
- } else {
- $elText.text($el.data(`${attrPrefix}Text`));
- }
- });
-};
-
Sidebar.prototype.sidebarCollapseClicked = function (e) {
if ($(e.currentTarget).hasClass('dont-change-state')) {
return;