diff --git a/website/client/components/chat/chatCard.vue b/website/client/components/chat/chatCard.vue
new file mode 100644
index 0000000000..f588ac8a5f
--- /dev/null
+++ b/website/client/components/chat/chatCard.vue
@@ -0,0 +1,276 @@
+
+div
+ .mentioned-icon(v-if='isUserMentioned')
+ .message-hidden(v-if='msg.flagCount === 1 && user.contributor.admin') Message flagged once, not hidden
+ .message-hidden(v-if='msg.flagCount > 1 && user.contributor.admin') Message hidden
+ .card-body
+ h3.leader(
+ :class='userLevelStyle(msg)',
+ @click="showMemberModal(msg.uuid)",
+ v-b-tooltip.hover.top="('contributor' in msg) ? msg.contributor.text : ''",
+ )
+ | {{msg.user}}
+ .svg-icon(v-html="tierIcon", v-if='showShowTierStyle')
+ p.time {{msg.timestamp | timeAgo}}
+ .text(v-markdown='msg.text')
+ hr
+ .action(@click='like()', v-if='msg.likes', :class='{active: msg.likes[user._id]}')
+ .svg-icon(v-html="icons.like")
+ span(v-if='!msg.likes[user._id]') {{ $t('like') }}
+ span(v-if='msg.likes[user._id]') {{ $t('liked') }}
+ // @TODO make copyAsTodo work in Tavern, guilds, party (inbox can be done later)
+ span.action(v-if='!inbox', @click='copyAsTodo(msg)')
+ .svg-icon(v-html="icons.copy")
+ | {{$t('copyAsTodo')}}
+ // @TODO make copyAsTodo work in the inbox
+ span.action(v-if='!inbox && user.flags.communityGuidelinesAccepted && msg.uuid !== "system"', @click='report(msg)')
+ .svg-icon(v-html="icons.report")
+ | {{$t('report')}}
+ // @TODO make flagging/reporting work in the inbox. NOTE: it must work even if the communityGuidelines are not accepted and it MUST work for messages that you have SENT as well as received. -- Alys
+ span.action(v-if='msg.uuid === user._id || inbox || user.contributor.admin', @click='remove()')
+ .svg-icon(v-html="icons.delete")
+ | {{$t('delete')}}
+ span.action.float-right.liked(v-if='likeCount > 0')
+ .svg-icon(v-html="icons.liked")
+ | + {{ likeCount }}
+
+
+
+
+
diff --git a/website/client/components/chat/chatMessages.vue b/website/client/components/chat/chatMessages.vue
index 7ab89ce50a..ddd2480197 100644
--- a/website/client/components/chat/chatMessages.vue
+++ b/website/client/components/chat/chatMessages.vue
@@ -2,9 +2,8 @@
.container
.row
.col-12
- copy-as-todo-modal(:copying-message='copyingMessage', :group-name='groupName', :group-id='groupId')
+ copy-as-todo-modal(:group-name='groupName', :group-id='groupId')
report-flag-modal
-
div(v-for="(msg, index) in messages", v-if='chat && canViewFlag(msg)')
// @TODO: is there a different way to do these conditionals? This creates an infinite loop
//.hr(v-if='displayDivider(msg)')
@@ -19,78 +18,22 @@
@click.native="showMemberModal(msg.uuid)",
)
.card(:class='inbox ? "col-8" : "col-10"')
- .mentioned-icon(v-if='isUserMentioned(msg)')
- .message-hidden(v-if='msg.flagCount === 1 && user.contributor.admin') Message flagged once, not hidden
- .message-hidden(v-if='msg.flagCount > 1 && user.contributor.admin') Message hidden
- .card-body
- h3.leader(
- :class='userLevelStyle(msg)',
- @click="showMemberModal(msg.uuid)",
- v-b-tooltip.hover.top="('contributor' in msg) ? msg.contributor.text : ''",
- )
- | {{msg.user}}
- .svg-icon(v-html="getTierIcon(msg)", v-if='showShowTierStyle(msg)')
- p.time {{msg.timestamp | timeAgo}}
- .text(v-markdown='msg.text')
- hr
- .action(@click='like(msg, index)', v-if='msg.likes', :class='{active: msg.likes[user._id]}')
- .svg-icon(v-html="icons.like")
- span(v-if='!msg.likes[user._id]') {{ $t('like') }}
- span(v-if='msg.likes[user._id]') {{ $t('liked') }}
- // @TODO make copyAsTodo work in Tavern, guilds, party (inbox can be done later)
- span.action(v-if='!inbox', @click='copyAsTodo(msg)')
- .svg-icon(v-html="icons.copy")
- | {{$t('copyAsTodo')}}
- // @TODO make copyAsTodo work in the inbox
- span.action(v-if='!inbox && user.flags.communityGuidelinesAccepted && msg.uuid !== "system"', @click='report(msg)')
- .svg-icon(v-html="icons.report")
- | {{$t('report')}}
- // @TODO make flagging/reporting work in the inbox. NOTE: it must work even if the communityGuidelines are not accepted and it MUST work for messages that you have SENT as well as received. -- Alys
- span.action(v-if='msg.uuid === user._id || inbox || user.contributor.admin', @click='remove(msg, index)')
- .svg-icon(v-html="icons.delete")
- | {{$t('delete')}}
- span.action.float-right.liked(v-if='likeCount(msg) > 0')
- .svg-icon(v-html="icons.liked")
- | + {{ likeCount(msg) }}
- // @TODO can we avoid duplicating all this code? Cannot we just push everything
- // to the right if the user is the author?
- // Maybe we just create two sub components instead
+ chat-card(
+ :msg='msg',
+ :inbox='inbox',
+ :groupId='groupId',
+ @messaged-liked='messageLiked',
+ @message-removed='messageRemoved',
+ @show-member-modal='showMemberModal')
.row(v-if='user._id === msg.uuid')
.card(:class='inbox ? "col-8" : "col-10"')
- .mentioned-icon(v-if='isUserMentioned(msg)')
- .message-hidden(v-if='msg.flagCount === 1 && user.contributor.admin') Message flagged once, not hidden
- .message-hidden(v-if='msg.flagCount > 1 && user.contributor.admin') Message hidden
- .card-body
- h3.leader(
- :class='userLevelStyle(msg)',
- @click="showMemberModal(msg.uuid)",
- v-b-tooltip.hover.top="('contributor' in msg) ? msg.contributor.text : ''",
- )
- | {{msg.user}}
- .svg-icon(v-html="getTierIcon(msg)", v-if='showShowTierStyle(msg)')
- p.time {{msg.timestamp | timeAgo}}
- .text(v-markdown='msg.text')
- hr
- .action(@click='like(msg, index)', v-if='msg.likes', :class='{active: msg.likes[user._id]}')
- .svg-icon(v-html="icons.like")
- span(v-if='!msg.likes[user._id]') {{ $t('like') }}
- span(v-if='msg.likes[user._id]') {{ $t('liked') }}
- // @TODO make copyAsTodo work in Tavern, guilds, party (inbox can be done later)
- span.action(v-if='!inbox', @click='copyAsTodo(msg)')
- .svg-icon(v-html="icons.copy")
- | {{$t('copyAsTodo')}}
- // @TODO make copyAsTodo work in the inbox
- span.action(v-if='user.flags.communityGuidelinesAccepted', @click='report(msg)')
- span.action(v-if='!inbox && user.flags.communityGuidelinesAccepted', @click='report(msg)')
- .svg-icon(v-html="icons.report")
- | {{$t('report')}}
- // @TODO make flagging/reporting work in the inbox. NOTE: it must work even if the communityGuidelines are not accepted and it MUST work for messages that you have SENT as well as received. -- Alys
- span.action(v-if='msg.uuid === user._id', @click='remove(msg, index)')
- .svg-icon(v-html="icons.delete")
- | {{$t('delete')}}
- span.action.float-right.liked(v-if='likeCount(msg) > 0')
- .svg-icon(v-html="icons.liked")
- | + {{ likeCount(msg) }}
+ chat-card(
+ :msg='msg',
+ :inbox='inbox',
+ :groupId='groupId',
+ @messaged-liked='messageLiked',
+ @message-removed='messageRemoved',
+ @show-member-modal='showMemberModal')
div(:class='inbox ? "col-4" : "col-2"')
avatar(
v-if='cachedProfileData[msg.uuid] && !cachedProfileData[msg.uuid].rejected',
@@ -103,38 +46,6 @@