Skip to content

Commit

Permalink
feat(message): disable emoji/reply in group chat (#3655)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwoodland committed Jun 16, 2022
1 parent 8622dfb commit d4b7552
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
24 changes: 22 additions & 2 deletions components/views/chat/message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import {
convertTimestampToDate,
} from '~/utilities/Messaging'
import { toHTML } from '~/libraries/ui/Markdown'
import { ContextMenuItem, EmojiUsage } from '~/store/ui/types'
import { ContextMenuItem, EmojiUsage, ModalWindows } from '~/store/ui/types'
import { isMimeEmbeddableImage } from '~/utilities/FileType'
import { FILE_TYPE } from '~/libraries/Files/types/file'
import placeholderImage from '~/assets/svg/mascot/sad_curious.svg'
import { RootState } from '~/types/store/store'
export default Vue.extend({
components: {
Expand Down Expand Up @@ -62,7 +63,12 @@ export default Vue.extend({
}
},
computed: {
...mapState(['ui', 'textile', 'accounts']),
...mapState({
ui: (state) => (state as RootState).ui,
textile: (state) => (state as RootState).textile,
accounts: (state) => (state as RootState).accounts,
isGroup: (state) => (state as RootState).conversation.type === 'group',
}),
...mapGetters('friends', ['findFriendByAddress']),
hasReactions(): boolean {
return (
Expand Down Expand Up @@ -230,6 +236,10 @@ export default Vue.extend({
* @example
*/
setReplyChatbarContent() {
if (this.isGroup) {
this.toggleModal(ModalWindows.CALL_TO_ACTION)
return
}
const myTextilePublicKey = this.$TextileManager.getIdentityPublicKey()
const { id, type, payload, to, from } = this.$props.message
let finalPayload = payload
Expand All @@ -253,6 +263,10 @@ export default Vue.extend({
* @example
*/
emojiReaction(e: MouseEvent) {
if (this.isGroup) {
this.toggleModal(ModalWindows.CALL_TO_ACTION)
return
}
const myTextilePublicKey = this.$TextileManager.getIdentityPublicKey()
this.$store.commit('ui/settingReaction', {
status: true,
Expand Down Expand Up @@ -350,6 +364,12 @@ export default Vue.extend({
return response.blob()
},
toggleModal(modalName: ModalWindows) {
this.$store.commit('ui/toggleModal', {
name: modalName,
state: !this.ui.modals[modalName],
})
},
},
})
</script>
Expand Down
6 changes: 4 additions & 2 deletions components/views/chat/message/actions/Actions.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div class="message-actions">
<div
class="reply-command"
v-tooltip.top="$t('ui.emotes')"
:class="{'coming-soon': isGroup}"
v-tooltip.top="$t(isGroup ? 'ui.coming_soon' : 'ui.emotes')"
@click="emojiReaction"
>
<smile-icon
Expand All @@ -12,7 +13,8 @@
<div
v-if="!hideReply"
class="reply-command"
v-tooltip.top="$t('messaging.reply')"
:class="{'coming-soon': isGroup}"
v-tooltip.top="$t(isGroup ? 'ui.coming_soon' : 'messaging.reply')"
@click="setReplyChatbarContent"
>
<corner-down-right-icon size="1x" :class="'control-icon'" />
Expand Down
9 changes: 7 additions & 2 deletions components/views/chat/message/actions/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { mapState } from 'vuex'
import { UIMessage } from '~/types/messaging'
import { ModalWindows } from '~/store/ui/types'
import { RootState } from '~/types/store/store'
export default Vue.extend({
components: {
Expand Down Expand Up @@ -57,10 +58,14 @@ export default Vue.extend({
}
},
computed: {
...mapState(['ui', 'accounts']),
...mapState({
ui: (state) => (state as RootState).ui,
accounts: (state) => (state as RootState).accounts,
isGroup: (state) => (state as RootState).conversation.type === 'group',
}),
isEditable(): boolean {
return (
this.message.from === this.accounts.details.textilePubkey &&
this.message.from === this.accounts.details?.textilePubkey &&
!(this.message.type === 'glyph' || this.message.type === 'file')
)
},
Expand Down
3 changes: 2 additions & 1 deletion locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
copied: 'ATTN: Copied to clipboard.',
send: 'Send',
emotes: 'Emoji',
coming_soon: 'Coming Soon',
glyphs: 'Glyphs',
fullscreen: 'Fullscreen',
exit_fullscreen: 'Exit fullscreen',
Expand Down Expand Up @@ -114,7 +115,7 @@ export default {
turn_off_camera: 'Turn Off Camera',
turn_on_camera: 'Turn On Camera',
crop: 'Crop',
edit: 'Edit\nComing Soon',
edit: 'Coming Soon',
end_stream: 'End Stream',
not_connected: 'Offline calling unavailable',
not_available: 'Not available yet',
Expand Down

0 comments on commit d4b7552

Please sign in to comment.