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

Fix select colors for sent messages and link text not selectable #1924

Merged
merged 4 commits into from Sep 17, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion main.js
Expand Up @@ -535,7 +535,7 @@ function showAbout() {
resizable: false,
title: locale.messages.about,
autoHideMenuBar: true,
backgroundColor: '#2090EA',
backgroundColor: '#ffffff',
show: false,
webPreferences: {
nodeIntegration: false,
Expand Down
3 changes: 2 additions & 1 deletion stylesheets/_global.scss
Expand Up @@ -100,7 +100,8 @@ button.grey {
}

a {
color: $blue;
cursor: auto;
user-select: text;
}

.file-input {
Expand Down
6 changes: 0 additions & 6 deletions stylesheets/_modules.scss
Expand Up @@ -1628,12 +1628,6 @@
background-color: rgba(var(--color-sent-message-text), 0.2);
}

// Module: Highlighted Message Body

.module-message-body__highlight {
font-weight: bold;
}

// Module: Search Results

.module-search-results {
Expand Down
8 changes: 4 additions & 4 deletions stylesheets/_session.scss
Expand Up @@ -36,13 +36,13 @@ textarea {
input,
textarea {
user-select: text;

&::selection {
background: var(--color-text-highlight);
}
}
}

::selection {
background: var(--color-text-highlight);
}

.shadowed {
opacity: $session-shadow-opacity;
}
Expand Down
5 changes: 5 additions & 0 deletions stylesheets/_session_conversation.scss
Expand Up @@ -197,6 +197,11 @@
min-height: $composition-container-height;
padding: $session-margin-md 0;

ul {
max-height: 70vh;
overflow: auto;
}

textarea {
font-family: $session-font-default;
min-height: $composition-container-height / 3;
Expand Down
88 changes: 0 additions & 88 deletions ts/components/MessageBodyHighlight.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion ts/components/conversation/message/MessageContextMenu.tsx
Expand Up @@ -64,6 +64,7 @@ export const MessageContextMenu = (props: Props) => {
} = selected;
const { messageId, contextMenuId } = props;
const showRetry = status === 'error' && direction === 'outgoing';
const isSent = status === 'sent';
const multipleAttachments = attachments && attachments.length > 1;

const onContextMenuShown = useCallback(() => {
Expand Down Expand Up @@ -168,7 +169,7 @@ export const MessageContextMenu = (props: Props) => {
) : null}

<Item onClick={copyText}>{window.i18n('copyMessage')}</Item>
<Item onClick={onReply}>{window.i18n('replyToMessage')}</Item>
{isSent && <Item onClick={onReply}>{window.i18n('replyToMessage')}</Item>}
<Item onClick={onShowDetail}>{window.i18n('moreInformation')}</Item>
{showRetry ? <Item onClick={onRetry}>{window.i18n('resend')}</Item> : null}
{isDeletable ? (
Expand Down
5 changes: 2 additions & 3 deletions ts/session/onions/onionPath.ts
Expand Up @@ -318,7 +318,7 @@ export async function TEST_testGuardNode(snode: Data.Snode) {
response = await insecureNodeFetch(url, fetchOptions);
} catch (e) {
if (e.type === 'request-timeout') {
window?.log?.warn('test timeout for node,', snode);
window?.log?.warn('test timeout for node,', ed25519Str(snode.pubkey_ed25519));
}
if (e.code === 'ENETUNREACH') {
window?.log?.warn('no network on node,', snode);
Expand Down Expand Up @@ -392,8 +392,7 @@ export async function selectGuardNodes(): Promise<Array<Data.Snode>> {
attempts++;
}

guardNodes = selectedGuardNodes;

guardNodes = selectedGuardNodes.slice(0, desiredGuardCount);
if (guardNodes.length < desiredGuardCount) {
window?.log?.error(`Cound't get enough guard nodes, only have: ${guardNodes.length}`);
throw new Error(`Cound't get enough guard nodes, only have: ${guardNodes.length}`);
Expand Down
10 changes: 9 additions & 1 deletion ts/session/sending/MessageSender.ts
Expand Up @@ -31,6 +31,13 @@ function overwriteOutgoingTimestampWithNetworkTimestamp(message: RawMessage) {
const contentDecoded = SignalService.Content.decode(plainTextBuffer);
const { dataMessage, dataExtractionNotification, typingMessage } = contentDecoded;
if (dataMessage && dataMessage.timestamp && dataMessage.timestamp > 0) {
// this is a sync message, do not overwrite the message timestamp
if (dataMessage.syncTarget) {
return {
overRiddenTimestampBuffer: plainTextBuffer,
diffTimestamp: _.toNumber(dataMessage.timestamp),
};
}
dataMessage.timestamp = diffTimestamp;
}
if (
Expand Down Expand Up @@ -86,7 +93,8 @@ export async function send(
// and the isDuplicate messages relies on sent_at timestamp to be valid.
const found = await Data.getMessageById(message.identifier);

if (found) {
// make sure to not update the send timestamp if this a currently syncing message
if (found && !found.get('sentSync')) {
found.set({ sent_at: diffTimestamp });
await found.commit();
}
Expand Down
4 changes: 2 additions & 2 deletions ts/state/ducks/SessionTheme.tsx
Expand Up @@ -50,7 +50,7 @@ const darkConversationItemSelected = '#404040';
const darkConversationItemHasUnread = '#2c2c2c';
const darkConversationList = '#1b1b1b';

const darkTextHighlight = accentDarkTheme;
const darkTextHighlight = `${white}88`;
const darkForegroundPrimary = white;
const darkBackgroundPrimary = '#474646';
const darkButtonGreen = accentDarkTheme;
Expand Down Expand Up @@ -179,7 +179,7 @@ const lightConversationItemSelected = '#f0f0f0';
const lightConversationItemHasUnread = '#fcfcfc';
const lightConversationList = '#f9f9f9';

const lightTextHighlight = accentLightTheme;
const lightTextHighlight = `${black}88`;
const lightForegroundPrimary = white;
const lightBackgroundPrimary = '#272726';
const lightButtonGreen = '#272726';
Expand Down