From 70cf860f788ac82b59bf42ec69697778651ce48a Mon Sep 17 00:00:00 2001 From: negue Date: Mon, 13 Jan 2025 22:28:30 +0100 Subject: [PATCH] fixing uiStates - removing disabled - moving the own user check to the last --- .../src/pages/private-messages/index.vue | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/website/client/src/pages/private-messages/index.vue b/website/client/src/pages/private-messages/index.vue index 8db81767216..b0f9b3c58b3 100644 --- a/website/client/src/pages/private-messages/index.vue +++ b/website/client/src/pages/private-messages/index.vue @@ -583,7 +583,6 @@ const UI_STATES = Object.freeze({ NO_CONVERSATIONS_SELECTED: 'NO_CONVERSATIONS_SELECTED', START_NEW_CONVERSATION: 'START_NEW_CONVERSATION', CONVERSATION_SELECTED: 'CONVERSATION_SELECTED', - DISABLED: 'DISABLED', }); export default defineComponent({ @@ -752,9 +751,7 @@ export default defineComponent({ description: this.$t('PMPlaceholderDescription'), }; }, - /** - * Any value return, switches the uiState to DISABLED - */ + disabledTexts () { if (this.user.flags.chatRevoked) { return { @@ -765,15 +762,6 @@ export default defineComponent({ }; } - if (this.user.inbox.optOut) { - return { - enableInput: true, - showBottomInfo: false, - title: this.$t('PMDisabledCaptionTitle'), - description: this.$t('PMDisabledCaptionText'), - }; - } - if (this.selectedConversation?.key) { if (this.user.inbox.blocks.includes(this.selectedConversation.key)) { return { @@ -794,6 +782,15 @@ export default defineComponent({ } } + if (this.user.inbox.optOut) { + return { + enableInput: true, + showBottomInfo: false, + title: this.$t('PMDisabledCaptionTitle'), + description: this.$t('PMDisabledCaptionText'), + }; + } + return null; }, optTextSet () { @@ -815,13 +812,12 @@ export default defineComponent({ return ''; }, newMessageDisabled () { - if (this.uiState === UI_STATES.DISABLED) { + if (this.disabledTexts) { return !this.disabledTexts.enableInput; } return [ UI_STATES.NO_CONVERSATIONS_SELECTED, - UI_STATES.DISABLED, UI_STATES.NO_CONVERSATIONS, UI_STATES.LOADING, ].includes(this.uiState); @@ -831,10 +827,6 @@ export default defineComponent({ return UI_STATES.LOADING; } - if (this.disabledTexts) { - return UI_STATES.DISABLED; - } - if (this.loadedConversations.length === 0) { return UI_STATES.NO_CONVERSATIONS; } @@ -857,8 +849,7 @@ export default defineComponent({ switch (currentUiState) { case UI_STATES.CONVERSATION_SELECTED: - case UI_STATES.START_NEW_CONVERSATION: - case UI_STATES.DISABLED: { + case UI_STATES.START_NEW_CONVERSATION: { return true; }