Page MenuHomePhorge

D5178.1765104046.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D5178.1765104046.diff

diff --git a/web/chat/message-list-types.js b/web/chat/message-list-types.js
--- a/web/chat/message-list-types.js
+++ b/web/chat/message-list-types.js
@@ -5,7 +5,10 @@
import type { MarkdownRules } from '../markdown/rules.react';
export type MessageListContextType = {
- +getTextMessageMarkdownRules: (useDarkStyle: boolean) => MarkdownRules,
+ +getTextMessageMarkdownRules: (
+ useDarkStyle: boolean,
+ isViewer: boolean,
+ ) => MarkdownRules,
};
export const MessageListContext: React.Context<?MessageListContextType> = React.createContext<?MessageListContextType>();
diff --git a/web/chat/text-message.react.js b/web/chat/text-message.react.js
--- a/web/chat/text-message.react.js
+++ b/web/chat/text-message.react.js
@@ -50,7 +50,10 @@
const messageListContext = React.useContext(MessageListContext);
invariant(messageListContext, 'DummyTextNode should have MessageListContext');
- const rules = messageListContext.getTextMessageMarkdownRules(darkColor);
+ const rules = messageListContext.getTextMessageMarkdownRules(
+ darkColor,
+ isViewer,
+ );
return (
<ComposedMessage
item={props.item}
diff --git a/web/markdown/rules.react.js b/web/markdown/rules.react.js
--- a/web/markdown/rules.react.js
+++ b/web/markdown/rules.react.js
@@ -69,9 +69,10 @@
const markdownRules: (
useDarkStyle: boolean,
+ isViewer: boolean,
threadColor: ?string,
) => MarkdownRules = _memoize(
- (useDarkStyle, threadColor) => {
+ (useDarkStyle, isViewer, threadColor) => {
const linkMarkdownRules = linkRules(useDarkStyle);
const simpleMarkdownRules = {
@@ -99,16 +100,22 @@
'--text-message-default-background',
);
}
- const backgroundColor = threadColor
- ? tinycolor(threadColor).darken(20).toString()
- : tinycolor(defaultTextMessageBackgroundColor)
- .lighten(40)
- .toString();
- const borderLeftColor = threadColor
- ? tinycolor(threadColor).darken(30).toString()
- : tinycolor(defaultTextMessageBackgroundColor)
- .lighten(20)
- .toString();
+
+ let backgroundColor = tinycolor(defaultTextMessageBackgroundColor)
+ .lighten(40)
+ .toString();
+ let borderLeftColor = tinycolor(defaultTextMessageBackgroundColor)
+ .lighten(20)
+ .toString();
+
+ if (threadColor) {
+ backgroundColor = isViewer
+ ? tinycolor(threadColor).darken(20).toString()
+ : tinycolor(threadColor).toString();
+ borderLeftColor = isViewer
+ ? tinycolor(threadColor).darken(30).toString()
+ : tinycolor(threadColor).darken(20).toString();
+ }
return (
<blockquote
@@ -179,7 +186,7 @@
function useTextMessageRulesFunc(
threadID: ?string,
-): ?(boolean) => MarkdownRules {
+): ?(useDarkStyle: boolean, isViewer: boolean) => MarkdownRules {
const threadMembers = useSelector(
relativeMemberInfoSelectorForMembersOfThread(threadID),
);
@@ -196,8 +203,10 @@
if (!threadMembers) {
return undefined;
}
- return _memoize<[boolean], MarkdownRules>((useDarkStyle: boolean) =>
- textMessageRules(threadMembers, useDarkStyle, threadColor),
+ return _memoize<[boolean, boolean], MarkdownRules>(
+ (useDarkStyle: boolean, isViewer: boolean) =>
+ textMessageRules(threadMembers, useDarkStyle, isViewer, threadColor),
+ (...args) => JSON.stringify(args),
);
}, [threadMembers, threadColor]);
}
@@ -205,9 +214,10 @@
function textMessageRules(
members: $ReadOnlyArray<RelativeMemberInfo>,
useDarkStyle: boolean,
+ isViewer: boolean,
threadColor: ?string,
): MarkdownRules {
- const baseRules = markdownRules(useDarkStyle, threadColor);
+ const baseRules = markdownRules(useDarkStyle, isViewer, threadColor);
return {
...baseRules,
simpleMarkdownRules: {
@@ -233,7 +243,7 @@
function getDefaultTextMessageRules(): MarkdownRules {
if (!defaultTextMessageRules) {
- defaultTextMessageRules = textMessageRules([], false, null);
+ defaultTextMessageRules = textMessageRules([], false, false, null);
}
return defaultTextMessageRules;
}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 7, 10:40 AM (1 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5843822
Default Alt Text
D5178.1765104046.diff (4 KB)

Event Timeline