Commit 0f6ecaa1 authored by Fatih Acet's avatar Fatih Acet

Implement canAward.

parent 654355a0
......@@ -16,6 +16,7 @@ export default {
emojiSmiling,
emojiSmile,
emojiSmiley,
canAward: !!window.gon.current_user_id,
};
},
computed: {
......@@ -42,6 +43,12 @@ export default {
getAwardHTML(name) {
return glEmojiTag(name);
},
getAwardClassBindings(awardList) {
return {
active: this.amIAwarded(awardList),
disabled: !this.canAward,
};
},
amIAwarded(awardList) {
const myUserId = window.gon.current_user_id;
const isAwarded = awardList.filter(award => award.user.id === myUserId);
......@@ -97,7 +104,7 @@ export default {
<button
v-for="(awardList, awardName) in groupedAwards"
class="btn award-control has-tooltip"
:class="{ active: amIAwarded(awardList) }"
:class="getAwardClassBindings(awardList)"
:title="awardTitle(awardList)"
data-placement="bottom"
type="button">
......@@ -106,7 +113,9 @@ export default {
{{awardList.length}}
</span>
</button>
<div class="award-menu-holder">
<div
v-if="canAward"
class="award-menu-holder">
<button
aria-label="Add reaction"
class="award-control btn has-tooltip"
......
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