Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(message): disable emoji/reply in group chat #3655

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -26,6 +26,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 @@ -113,7 +114,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