diff --git a/ts/components/conversation/ConversationHeaderTitle.tsx b/ts/components/conversation/ConversationHeaderTitle.tsx index b582e73fd..23536336d 100644 --- a/ts/components/conversation/ConversationHeaderTitle.tsx +++ b/ts/components/conversation/ConversationHeaderTitle.tsx @@ -80,6 +80,7 @@ export type ConversationHeaderTitleProps = { expireTimer?: number; }; +// tslint:disable: cyclomatic-complexity max-func-body-length export const ConversationHeaderTitle = () => { const headerTitleProps = useSelector(getConversationHeaderTitleProps); const notificationSetting = useSelector(getCurrentNotificationSettingText); @@ -111,6 +112,9 @@ export const ConversationHeaderTitle = () => { const notificationSubtitle = notificationSetting ? i18n('notificationSubtitle', [notificationSetting]) : null; + if (notificationSubtitle) { + subtitles.push(notificationSubtitle); + } let memberCount = 0; if (isGroup) { @@ -120,9 +124,6 @@ export const ConversationHeaderTitle = () => { memberCount = members.length; } } - if (notificationSubtitle) { - subtitles.push(notificationSubtitle); - } let memberCountSubtitle = null; if (isGroup && memberCount > 0 && !isKickedFromGroup) { @@ -166,6 +167,19 @@ export const ConversationHeaderTitle = () => { } }; + const handleRightPanelToggle = () => { + if (isRightPanelOn) { + dispatch(closeRightPanel()); + } else { + if (visibleTitleIndex === 2) { + dispatch(setRightOverlayMode('disappearing-messages')); + } else { + dispatch(setRightOverlayMode('panel-settings')); + } + dispatch(openRightPanel()); + } + }; + useEffect(() => { setVisibleTitleIndex(0); }, [convoName]); @@ -180,18 +194,7 @@ export const ConversationHeaderTitle = () => {
{ - if (isRightPanelOn) { - dispatch(closeRightPanel()); - } else { - if (visibleTitleIndex === 2) { - dispatch(setRightOverlayMode('disappearing-messages')); - } else { - dispatch(setRightOverlayMode('panel-settings')); - } - dispatch(openRightPanel()); - } - }} + onClick={handleRightPanelToggle} role="button" > { - let options = state.timerOptions.timerOptions; + const options = state.timerOptions.timerOptions; switch (disappearingMessageMode) { case 'deleteAfterSend': diff --git a/ts/models/conversation.ts b/ts/models/conversation.ts index aa1f0f853..b12c4994f 100644 --- a/ts/models/conversation.ts +++ b/ts/models/conversation.ts @@ -1142,7 +1142,7 @@ export class ConversationModel extends Backbone.Model { if (this.isMe()) { // TODO Check that the args are correct if (expireUpdate.expirationType === 'deleteAfterRead') { - window.log.info(`WIP: Note to Self messages cannot be delete after read!`); + window.log.info('WIP: Note to Self messages cannot be delete after read!'); return; } diff --git a/ts/node/sql.ts b/ts/node/sql.ts index 96083b0b0..fabaddef0 100644 --- a/ts/node/sql.ts +++ b/ts/node/sql.ts @@ -2281,7 +2281,7 @@ function cleanUpOldOpengroupsOnStart() { })(); } -// tslint:disable: binary-expression-operand-order insecure-random +// tslint:disable: max-func-body-length binary-expression-operand-order insecure-random /** * Only using this for development. Populate conversation and message tables. */ diff --git a/ts/receiver/dataMessage.ts b/ts/receiver/dataMessage.ts index 0d36cd26a..2e74dc1fd 100644 --- a/ts/receiver/dataMessage.ts +++ b/ts/receiver/dataMessage.ts @@ -245,7 +245,7 @@ export async function handleSwarmDataMessage( if (isSyncedMessage) { // TODO handle sync messages separately - console.log(`WIP: Sync Message dropping`); + window.log.info('WIP: Sync Message dropping'); } else { if (msgModel.isIncoming() && expireUpdate.expirationType === 'deleteAfterSend') { msgModel = diff --git a/ts/session/apis/snode_api/expire.ts b/ts/session/apis/snode_api/expire.ts index 829564aa7..eb3b28fb9 100644 --- a/ts/session/apis/snode_api/expire.ts +++ b/ts/session/apis/snode_api/expire.ts @@ -247,6 +247,7 @@ export async function expireMessageOnSnode(messageHash: string, expireTimer: num let snode: Snode | undefined; try { const firstSuccessSnode = await firstTrue(promises); + snode = firstSuccessSnode; console.log(`WIP: expireMessageOnSnode firstSuccessSnode`, firstSuccessSnode); } catch (e) { const snodeStr = snode ? `${snode.ip}:${snode.port}` : 'null'; diff --git a/ts/session/sending/MessageSentHandler.ts b/ts/session/sending/MessageSentHandler.ts index b839340cf..967365c60 100644 --- a/ts/session/sending/MessageSentHandler.ts +++ b/ts/session/sending/MessageSentHandler.ts @@ -41,7 +41,7 @@ async function handlePublicMessageSentSuccess( } } -// tslint:disable-next-line: cyclomatic-complexity +// tslint:disable-next-line:// tslint:disable-next-line: cyclomatic-complexity async function handleMessageSentSuccess( sentMessage: RawMessage, effectiveTimestamp: number, @@ -100,14 +100,13 @@ async function handleMessageSentSuccess( void PnServer.notifyPnServer(wrappedEnvelope, sentMessage.device); } } - - if (!shouldMarkMessageAsSynced && fetchedMessage.get('expirationType')) { - fetchedMessage = - setExpirationStartTimestamp( - fetchedMessage, - fetchedMessage.get('expirationType')!, - effectiveTimestamp - ) || fetchedMessage; + if (!shouldMarkMessageAsSynced) { + const expirationType = fetchedMessage.get('expirationType'); + if (expirationType) { + fetchedMessage = + setExpirationStartTimestamp(fetchedMessage, expirationType, effectiveTimestamp) || + fetchedMessage; + } } // Handle the sync logic here @@ -170,10 +169,9 @@ async function handleMessageSentFailure( } } - if (fetchedMessage.get('expirationType')) { - fetchedMessage = - setExpirationStartTimestamp(fetchedMessage, fetchedMessage.get('expirationType')!) || - fetchedMessage; + const expirationType = fetchedMessage.get('expirationType'); + if (expirationType) { + fetchedMessage = setExpirationStartTimestamp(fetchedMessage, expirationType) || fetchedMessage; } // always mark the message as sent. diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index 30ba315ed..9116d61c7 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -16,7 +16,6 @@ import { getIntl } from './user'; import { BlockedNumberController } from '../../util'; import { ConversationModel } from '../../models/conversation'; import { LocalizerType } from '../../types/Util'; -import { ConversationHeaderTitleProps } from '../../components/conversation/ConversationHeader'; import { ReplyingToMessageProps } from '../../components/conversation/composition/CompositionBox'; import { MessageAttachmentSelectorProps } from '../../components/conversation/message/message-content/MessageAttachment'; import { MessageAuthorSelectorProps } from '../../components/conversation/message/message-content/MessageAuthorText'; @@ -38,6 +37,7 @@ import { ConversationTypeEnum } from '../../models/conversationAttributes'; import { MessageReactsSelectorProps } from '../../components/conversation/message/message-content/MessageReactions'; import { filter, isEmpty, pick, sortBy } from 'lodash'; import { DisappearingMessageConversationSetting } from '../../util/expiringMessages'; +import { ConversationHeaderTitleProps } from '../../components/conversation/ConversationHeaderTitle'; export const getConversations = (state: StateType): ConversationsStateType => state.conversations; diff --git a/ts/util/readReceipts.ts b/ts/util/readReceipts.ts index 02f057e1d..b6674eaca 100644 --- a/ts/util/readReceipts.ts +++ b/ts/util/readReceipts.ts @@ -45,7 +45,9 @@ async function onReadReceipt(receipt: { source: string; timestamp: number; readA // readBy is only used for private conversations // we do not care of who read it. If the length is > 0 , it is read and false otherwise let readBy = message.get('read_by') || []; - let expirationStartTimestamp = undefined; + // TODO Fix this with read receipts + // tslint:disable-next-line: no-unnecessary-initializer + const expirationStartTimestamp = undefined; if (!readBy.length) { readBy.push(receipt.source);