Commit 0555d691 authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Handle /award quick action.

parent 8a130d85
......@@ -78,10 +78,6 @@ export default {
data-position="right"
href="#"
title="Add reaction">
<i
aria-hidden="true"
data-hidden="true"
class="fa fa-spinner fa-spin"></i>
<span
v-html="emojiSmiling"
class="link-highlight award-control-icon-neutral"></span>
......
......@@ -2,6 +2,7 @@
import service from '../services/issue_notes_service';
import utils from './issue_notes_utils';
import loadAwardsHandler from '../../awards_handler';
const state = {
notes: [],
......@@ -225,12 +226,25 @@ const actions = {
.then((res) => {
const { errors } = res;
if (hasQuickActions) {
if (hasQuickActions && Object.keys(errors).length) {
context.dispatch('poll');
$('.js-gfm-input').trigger('clear-commands-cache.atwho');
new Flash('Commands applied', 'notice', $(noteData.flashContainer)); // eslint-disable-line
}
if (res.commands_changes.emoji_award) {
const votesBlock = $('.js-awards-block').eq(0);
loadAwardsHandler().then((awardsHandler) => {
awardsHandler.addAwardToEmojiBar(votesBlock, res.commands_changes.emoji_award);
awardsHandler.scrollToAwards();
}).catch(() => {
const msg = 'Something went wrong while adding your award. Please try again.';
new Flash(msg, $(noteData.flashContainer)); // eslint-disable-line
});
}
if (errors && errors.commands_only) {
new Flash(errors.commands_only, 'notice', $(noteData.flashContainer)); // eslint-disable-line
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment