From 2aef1f313291a1aa8b105955d3d9d72642204237 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 9 Sep 2020 10:39:55 +1000 Subject: [PATCH 1/3] be sure blocked border is shown even with mention or unread --- stylesheets/_modules.scss | 6 ++++++ stylesheets/_session.scss | 2 -- stylesheets/_session_group_panel.scss | 4 +++- stylesheets/_session_left_pane.scss | 2 +- stylesheets/_theme_dark.scss | 9 --------- stylesheets/themes.scss | 2 ++ 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index e252c7f6f..9376aa3f2 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -1520,6 +1520,12 @@ .module-avatar { background-color: $color-dark-85; } + + &--is-blocked { + @include themify($themes) { + border-left: 4px solid themed('destructive') !important; + } + } } .module-conversation-list-item__unread-count { diff --git a/stylesheets/_session.scss b/stylesheets/_session.scss index 5456d8aae..abcad5b3c 100644 --- a/stylesheets/_session.scss +++ b/stylesheets/_session.scss @@ -344,8 +344,6 @@ textarea { } } -$session-element-border-green: 4px solid $session-color-green; - /* CONVERSATION AND MESSAGES */ @mixin standard-icon-button() { diff --git a/stylesheets/_session_group_panel.scss b/stylesheets/_session_group_panel.scss index 5cee99926..4096f899a 100644 --- a/stylesheets/_session_group_panel.scss +++ b/stylesheets/_session_group_panel.scss @@ -132,7 +132,9 @@ margin: 0 auto; width: 70%; padding-top: 0.5rem; - border-bottom: $session-element-border-green; + @include themify($themes) { + border-bottom: themed('sessionUnreadBorder'); + } } } } diff --git a/stylesheets/_session_left_pane.scss b/stylesheets/_session_left_pane.scss index 45b3160c2..7338410aa 100644 --- a/stylesheets/_session_left_pane.scss +++ b/stylesheets/_session_left_pane.scss @@ -48,8 +48,8 @@ $session-compose-margin: 20px; } &--has-unread { - border-left: $session-element-border-green !important; @include themify($themes) { + border-left: themed('sessionUnreadBorder'); background: themed('conversationItemHasUnread'); } } diff --git a/stylesheets/_theme_dark.scss b/stylesheets/_theme_dark.scss index b2ba60f25..baef39f70 100644 --- a/stylesheets/_theme_dark.scss +++ b/stylesheets/_theme_dark.scss @@ -664,17 +664,8 @@ .module-empty-state { color: $color-dark-55; } - // Module: Conversation List Item - .module-conversation-list-item--has-unread { - border-left: 4px solid $color-loki-green; - } - - .module-conversation-list-item--is-blocked { - border-left: 4px solid $session-color-danger; - } - .module-conversation-list-item--is-selected { background-color: $color-dark-70; } diff --git a/stylesheets/themes.scss b/stylesheets/themes.scss index 070d34596..45abec93d 100644 --- a/stylesheets/themes.scss +++ b/stylesheets/themes.scss @@ -41,6 +41,7 @@ $themes: ( conversationItemSelected: #f0f0f0, clickableHovered: #dfdfdf, sessionBorder: 1px solid #f1f1f1, + sessionUnreadBorder: 4px solid $accentLightTheme, leftpaneOverlayBackground: $white, // scrollbars scrollBarTrack: #fcfcfc, @@ -91,6 +92,7 @@ $themes: ( conversationItemSelected: #404040, clickableHovered: #414347, sessionBorder: 1px solid rgba($white, 0.06), + sessionUnreadBorder: 4px solid $accentDarkTheme, leftpaneOverlayBackground: linear-gradient(180deg, #171717 0%, #121212 100%), // scrollbars scrollBarTrack: #1b1b1b, From d3badba681d2a83d6b4ecb09a1e101d9a13bb376 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 9 Sep 2020 10:48:26 +1000 Subject: [PATCH 2/3] hide reset session from menu when user is blocked --- ts/components/conversation/ConversationHeader.tsx | 1 + ts/session/utils/Menu.tsx | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ts/components/conversation/ConversationHeader.tsx b/ts/components/conversation/ConversationHeader.tsx index 94c0baef5..25c4cc45b 100644 --- a/ts/components/conversation/ConversationHeader.tsx +++ b/ts/components/conversation/ConversationHeader.tsx @@ -475,6 +475,7 @@ export class ConversationHeader extends React.Component { isPublic, isRss, isGroup, + isBlocked, onResetSession, i18n ); diff --git a/ts/session/utils/Menu.tsx b/ts/session/utils/Menu.tsx index 1834daf48..2d7637f43 100644 --- a/ts/session/utils/Menu.tsx +++ b/ts/session/utils/Menu.tsx @@ -32,9 +32,10 @@ function showSafetyNumber( function showResetSession( isPublic: boolean, isRss: boolean, - isGroup: boolean + isGroup: boolean, + isBlocked: boolean ): boolean { - return !isPublic && !isRss && !isGroup; + return !isPublic && !isRss && !isGroup && !isBlocked; } function showBlock(isMe: boolean, isPrivate: boolean): boolean { @@ -299,10 +300,11 @@ export function getResetSessionMenuItem( isPublic: boolean | undefined, isRss: boolean | undefined, isGroup: boolean | undefined, + isBlocked: boolean | undefined, action: any, i18n: LocalizerType ): JSX.Element | null { - if (showResetSession(Boolean(isPublic), Boolean(isRss), Boolean(isGroup))) { + if (showResetSession(Boolean(isPublic), Boolean(isRss), Boolean(isGroup), Boolean(isBlocked),)) { return {i18n('resetSession')}; } return null; From 84c7ce006b9585b3b6cffa527760e26c19629ec2 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 9 Sep 2020 11:16:33 +1000 Subject: [PATCH 3/3] fix ctx menu on repeated block/unblock --- ts/components/ConversationListItem.tsx | 2 +- ts/components/conversation/ConversationHeader.tsx | 2 +- ts/components/conversation/Message.tsx | 8 ++++---- ts/session/utils/Menu.tsx | 9 ++++++++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ts/components/ConversationListItem.tsx b/ts/components/ConversationListItem.tsx index 076e13976..0b2a71ef5 100644 --- a/ts/components/ConversationListItem.tsx +++ b/ts/components/ConversationListItem.tsx @@ -309,7 +309,7 @@ export class ConversationListItem extends React.PureComponent { mentionedUs, } = this.props; - const triggerId = `${phoneNumber}-ctxmenu-${Date.now()}`; + const triggerId = `conversation-item-${phoneNumber}-ctxmenu`; return (
diff --git a/ts/components/conversation/ConversationHeader.tsx b/ts/components/conversation/ConversationHeader.tsx index 25c4cc45b..c097a2ad1 100644 --- a/ts/components/conversation/ConversationHeader.tsx +++ b/ts/components/conversation/ConversationHeader.tsx @@ -389,7 +389,7 @@ export class ConversationHeader extends React.Component { public render() { const { id, isKickedFromGroup } = this.props; - const triggerId = `conversation-${id}-${Date.now()}`; + const triggerId = `conversation-header-${id}`; return ( <> diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx index 6d1974ff2..be36185be 100644 --- a/ts/components/conversation/Message.tsx +++ b/ts/components/conversation/Message.tsx @@ -1073,11 +1073,11 @@ export class Message extends React.PureComponent { // It needs to be unique. // The Date.now() is a workaround to be sure a single triggerID with this id exists const triggerId = id - ? String(`${id}-${Date.now()}`) - : String(`${authorPhoneNumber}-${timestamp}`); + ? String(`message-${id}-${Date.now()}`) + : String(`message-${authorPhoneNumber}-${timestamp}`); const rightClickTriggerId = id - ? String(`${id}-ctx-${Date.now()}`) - : String(`${authorPhoneNumber}-ctx-${timestamp}`); + ? String(`message-ctx-${id}-${Date.now()}`) + : String(`message-ctx-${authorPhoneNumber}-${timestamp}`); if (expired) { return null; } diff --git a/ts/session/utils/Menu.tsx b/ts/session/utils/Menu.tsx index 2d7637f43..2fe4b77f6 100644 --- a/ts/session/utils/Menu.tsx +++ b/ts/session/utils/Menu.tsx @@ -304,7 +304,14 @@ export function getResetSessionMenuItem( action: any, i18n: LocalizerType ): JSX.Element | null { - if (showResetSession(Boolean(isPublic), Boolean(isRss), Boolean(isGroup), Boolean(isBlocked),)) { + if ( + showResetSession( + Boolean(isPublic), + Boolean(isRss), + Boolean(isGroup), + Boolean(isBlocked) + ) + ) { return {i18n('resetSession')}; } return null;