diff --git a/main.js b/main.js index b5ad53f93..1afb728e0 100644 --- a/main.js +++ b/main.js @@ -442,7 +442,6 @@ function openReleaseNotes() { ); } - function openSupportPage() { shell.openExternal('https://docs.oxen.io/products-built-on-oxen/session'); } diff --git a/stylesheets/_session.scss b/stylesheets/_session.scss index 219a1d4ca..5af810b38 100644 --- a/stylesheets/_session.scss +++ b/stylesheets/_session.scss @@ -1206,6 +1206,7 @@ input { .session-member-item { cursor: pointer; + flex-shrink: 0; font-family: $session-font-default; padding: 0px $session-margin-sm; height: 50px; diff --git a/ts/components/registration/RegistrationStages.tsx b/ts/components/registration/RegistrationStages.tsx index 56f9cf7ef..0e5767359 100644 --- a/ts/components/registration/RegistrationStages.tsx +++ b/ts/components/registration/RegistrationStages.tsx @@ -62,6 +62,7 @@ export async function signUp(signUpDetails: { await createOrUpdateItem({ id: 'hasSyncedInitialConfigurationItem', value: true, + timestamp: Date.now(), }); UserUtils.setSignWithRecoveryPhrase(false); trigger('openInbox'); diff --git a/ts/receiver/closedGroups.ts b/ts/receiver/closedGroups.ts index c30877136..7f88d44c0 100644 --- a/ts/receiver/closedGroups.ts +++ b/ts/receiver/closedGroups.ts @@ -114,7 +114,7 @@ export async function handleClosedGroupControlMessage( if ( !getConversationController() .get(envelope.senderIdentity) - .isApproved() + ?.isApproved() ) { window?.log?.info( 'Received new closed group message from an unapproved sender -- dropping message.' diff --git a/ts/receiver/configMessage.ts b/ts/receiver/configMessage.ts index b2283039b..8c3801673 100644 --- a/ts/receiver/configMessage.ts +++ b/ts/receiver/configMessage.ts @@ -55,11 +55,11 @@ async function handleGroupsAndContactsFromConfigMessage( envelope: EnvelopePlus, configMessage: SignalService.ConfigurationMessage ) { + const envelopeTimestamp = _.toNumber(envelope.timestamp); const lastConfigUpdate = await getItemById(hasSyncedInitialConfigurationItem); const lastConfigTimestamp = lastConfigUpdate?.timestamp; const isNewerConfig = - !lastConfigTimestamp || - (lastConfigTimestamp && lastConfigTimestamp < _.toNumber(envelope.timestamp)); + !lastConfigTimestamp || (lastConfigTimestamp && lastConfigTimestamp < envelopeTimestamp); if (!isNewerConfig) { window?.log?.info('Received outdated configuration message... Dropping message.'); @@ -69,32 +69,14 @@ async function handleGroupsAndContactsFromConfigMessage( await createOrUpdateItem({ id: 'hasSyncedInitialConfigurationItem', value: true, - timestamp: _.toNumber(envelope.timestamp), + timestamp: envelopeTimestamp, }); - const numberClosedGroup = configMessage.closedGroups?.length || 0; - - window?.log?.info( - `Received ${numberClosedGroup} closed group on configuration. Creating them... ` - ); - - await Promise.all( - configMessage.closedGroups.map(async c => { - const groupUpdate = new SignalService.DataMessage.ClosedGroupControlMessage({ - type: SignalService.DataMessage.ClosedGroupControlMessage.Type.NEW, - encryptionKeyPair: c.encryptionKeyPair, - name: c.name, - admins: c.admins, - members: c.members, - publicKey: c.publicKey, - }); - try { - await handleNewClosedGroup(envelope, groupUpdate); - } catch (e) { - window?.log?.warn('failed to handle a new closed group from configuration message'); - } - }) - ); + // we only want to apply changes to closed groups if we never got them + // new opengroups get added when we get a new closed group message from someone, or a sync'ed message from outself creating the group + if (!lastConfigTimestamp) { + await handleClosedGroupsFromConfig(configMessage.closedGroups, envelope); + } handleOpenGroupsFromConfig(configMessage.openGroups); @@ -105,7 +87,6 @@ async function handleGroupsAndContactsFromConfigMessage( /** * Trigger a join for all open groups we are not already in. - * Currently, if you left an open group but kept the conversation, you won't rejoin it here. * @param openGroups string array of open group urls */ const handleOpenGroupsFromConfig = (openGroups: Array) => { @@ -126,6 +107,40 @@ const handleOpenGroupsFromConfig = (openGroups: Array) => { } }; +/** + * Trigger a join for all closed groups which doesn't exist yet + * @param openGroups string array of open group urls + */ +const handleClosedGroupsFromConfig = async ( + closedGroups: Array, + envelope: EnvelopePlus +) => { + const numberClosedGroup = closedGroups?.length || 0; + + window?.log?.info( + `Received ${numberClosedGroup} closed group on configuration. Creating them... ` + ); + await Promise.all( + closedGroups.map(async c => { + const groupUpdate = new SignalService.DataMessage.ClosedGroupControlMessage({ + type: SignalService.DataMessage.ClosedGroupControlMessage.Type.NEW, + encryptionKeyPair: c.encryptionKeyPair, + name: c.name, + admins: c.admins, + members: c.members, + publicKey: c.publicKey, + }); + try { + // TODO we should not drop the envelope from cache as long as we are still handling a new closed group from that same envelope + // check the removeFromCache inside handleNewClosedGroup() + await handleNewClosedGroup(envelope, groupUpdate); + } catch (e) { + window?.log?.warn('failed to handle a new closed group from configuration message'); + } + }) + ); +}; + /** * Handles adding of a contact and setting approval/block status * @param contactReceived Contact to sync diff --git a/ts/state/ducks/SessionTheme.tsx b/ts/state/ducks/SessionTheme.tsx index 8a88e81d4..de2d7a36a 100644 --- a/ts/state/ducks/SessionTheme.tsx +++ b/ts/state/ducks/SessionTheme.tsx @@ -170,11 +170,10 @@ const lightColorAccentButton = black; const lightColorText = black; const lightColorTextOpposite = white; const lightColorTextSubtle = `${black}99`; -const lightColorTextAccent = '#00c769'; +const lightColorTextAccent = accentLightTheme; const lightColorSessionShadow = `0 0 4px 0 ${black}5E`; const lightColorComposeViewBg = '#efefef'; -const lightColorSentMessageBg = 'hsl(152, 100%, 40%)'; -const lightColorSentMessageText = white; +const lightColorSentMessageBg = accentLightTheme; const lightColorClickableHovered = '#dfdfdf'; const lightColorSessionBorderColor = borderLightThemeColor; const lightColorSessionBorder = `1px solid ${lightColorSessionBorderColor}`; @@ -232,10 +231,7 @@ export const switchHtmlToLightTheme = () => { '--color-sent-message-background', lightColorSentMessageBg ); - document.documentElement.style.setProperty( - '--color-sent-message-text', - lightColorSentMessageText - ); + document.documentElement.style.setProperty('--color-sent-message-text', darkColorSentMessageText); document.documentElement.style.setProperty( '--color-clickable-hovered', lightColorClickableHovered @@ -364,7 +360,7 @@ export const SessionGlobalStyles = createGlobalStyle` --color-session-shadow: ${lightColorSessionShadow}; --color-compose-view-button-background: ${lightColorComposeViewBg}; --color-sent-message-background: ${lightColorSentMessageBg}; - --color-sent-message-text: ${lightColorSentMessageText}; + --color-sent-message-text: ${darkColorSentMessageText}; --color-clickable-hovered: ${lightColorClickableHovered}; --color-session-border: ${lightColorSessionBorderColor}; --color-recovery-phrase-banner-background: ${lightColorRecoveryPhraseBannerBg}; diff --git a/ts/util/getInitials.ts b/ts/util/getInitials.ts index b890870f6..8c7bb4777 100644 --- a/ts/util/getInitials.ts +++ b/ts/util/getInitials.ts @@ -7,9 +7,12 @@ export function getInitials(name?: string): string | undefined { return name[2]; } - const initials = name.split(' ').slice(0, 2).map(n => { - return n[0]; - }) + const initials = name + .split(' ') + .slice(0, 2) + .map(n => { + return n[0]; + }); return initials.join(''); }