diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-27 21:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-27 21:08:59 +0300 |
commit | f3b9e205bb8dc4f0e8ebff79cf364fede886014b (patch) | |
tree | ce9819fa446271f94e32af2cca1c02d618c3d9aa /app/assets | |
parent | 2b1e7f7dac0fa5d7bb3bdf415cec1b3c67ed77b0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/awards_handler.js | 37 | ||||
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 3 |
2 files changed, 18 insertions, 22 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index 7055cd42978..17e6255700a 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -5,11 +5,11 @@ import { uniq } from 'lodash'; import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils'; import Cookies from 'js-cookie'; import { __ } from './locale'; -import { updateTooltipTitle } from './lib/utils/common_utils'; import { isInVueNoteablePage } from './lib/utils/dom_utils'; import { deprecatedCreateFlash as flash } from './flash'; import axios from './lib/utils/axios_utils'; import * as Emoji from '~/emoji'; +import { dispose, fixTitle } from '~/tooltips'; const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd'; const transitionEndEventString = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'; @@ -374,7 +374,7 @@ export class AwardsHandler { counter.text(counterNumber - 1); this.removeYouFromUserList($emojiButton); } else if (emoji === 'thumbsup' || emoji === 'thumbsdown') { - $emojiButton.tooltip('dispose'); + dispose($emojiButton); counter.text('0'); this.removeYouFromUserList($emojiButton); if ($emojiButton.parents('.note').length) { @@ -387,7 +387,8 @@ export class AwardsHandler { } removeEmoji($emojiButton) { - $emojiButton.tooltip('dispose'); + dispose($emojiButton); + $emojiButton.remove(); const $votesBlock = this.getVotesBlock(); if ($votesBlock.find('.js-emoji-btn').length === 0) { @@ -415,13 +416,17 @@ export class AwardsHandler { const originalTitle = this.getAwardTooltip(awardBlock); const authors = originalTitle.split(FROM_SENTENCE_REGEX); authors.splice(authors.indexOf('You'), 1); - return awardBlock + + awardBlock .closest('.js-emoji-btn') .removeData('title') .removeAttr('data-title') .removeAttr('data-original-title') - .attr('title', this.toSentence(authors)) - .tooltip('_fixTitle'); + .attr('title', this.toSentence(authors)); + + fixTitle(awardBlock); + + return awardBlock; } addYouToUserList(votesBlock, emoji) { @@ -432,7 +437,12 @@ export class AwardsHandler { users = origTitle.trim().split(FROM_SENTENCE_REGEX); } users.unshift('You'); - return awardBlock.attr('title', this.toSentence(users)).tooltip('_fixTitle'); + + awardBlock.attr('title', this.toSentence(users)); + + fixTitle(awardBlock); + + return awardBlock; } createAwardButtonForVotesBlock(votesBlock, emojiName) { @@ -448,7 +458,7 @@ export class AwardsHandler { .find('.emoji-icon') .data('name', emojiName); this.animateEmoji($emojiButton); - $('.award-control').tooltip(); + votesBlock.removeClass('current'); } @@ -487,17 +497,6 @@ export class AwardsHandler { return votesBlock.find(`.js-emoji-btn [data-name="${emoji}"]`); } - userAuthored($emojiButton) { - const oldTitle = this.getAwardTooltip($emojiButton); - const newTitle = 'You cannot vote on your own issue, MR and note'; - updateTooltipTitle($emojiButton, newTitle).tooltip('show'); - // Restore tooltip back to award list - return setTimeout(() => { - $emojiButton.tooltip('hide'); - updateTooltipTitle($emojiButton, oldTitle); - }, 2800); - } - scrollToAwards() { const options = { scrollTop: $('.awards').offset().top - 110, diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index fe1ac00fd1d..7845f2968db 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -61,9 +61,6 @@ export const rstrip = val => { return val; }; -export const updateTooltipTitle = ($tooltipEl, newTitle) => - $tooltipEl.attr('title', newTitle).tooltip('_fixTitle'); - export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventName = 'input') => { const field = $(fieldSelector); const closestSubmit = field.closest('form').find(buttonSelector); |