mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-14 08:34:25 +03:00
Merge pull request #4609 from urbit/la/display-contact-appropriately
interface: only display our contact when appropriate
This commit is contained in:
commit
0508edbece
@ -139,9 +139,6 @@ export function ChatResource(props: ChatResourceProps) {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
const modifiedContacts = { ...contacts };
|
||||
delete modifiedContacts[`~${window.ship}`];
|
||||
|
||||
return (
|
||||
<Col {...bind} height="100%" overflow="hidden" position="relative">
|
||||
<ShareProfile
|
||||
@ -160,10 +157,7 @@ export function ChatResource(props: ChatResourceProps) {
|
||||
history={props.history}
|
||||
graph={graph}
|
||||
unreadCount={unreadCount}
|
||||
contacts={
|
||||
(!showBanner && hasLoadedAllowed) ?
|
||||
contacts : modifiedContacts
|
||||
}
|
||||
showOurContact={ !showBanner && hasLoadedAllowed }
|
||||
association={props.association}
|
||||
pendingSize={Object.keys(graphTimesentMap[graphPath] || {}).length}
|
||||
group={group}
|
||||
@ -181,9 +175,6 @@ export function ChatResource(props: ChatResourceProps) {
|
||||
(!showBanner && hasLoadedAllowed) ? ourContact : null
|
||||
}
|
||||
envelopes={[]}
|
||||
contacts={
|
||||
(!showBanner && hasLoadedAllowed) ? contacts : modifiedContacts
|
||||
}
|
||||
onUnmount={appendUnsent}
|
||||
placeholder="Message..."
|
||||
message={unsent[station] || ''}
|
||||
|
@ -263,6 +263,7 @@ class ChatMessage extends Component<ChatMessageProps> {
|
||||
history,
|
||||
api,
|
||||
highlighted,
|
||||
showOurContact,
|
||||
fontSize
|
||||
} = this.props;
|
||||
|
||||
@ -295,6 +296,7 @@ class ChatMessage extends Component<ChatMessageProps> {
|
||||
style,
|
||||
containerClass,
|
||||
isPending,
|
||||
showOurContact,
|
||||
history,
|
||||
api,
|
||||
scrollWindow,
|
||||
@ -355,6 +357,7 @@ export const MessageAuthor = ({
|
||||
api,
|
||||
history,
|
||||
scrollWindow,
|
||||
showOurContact,
|
||||
...rest
|
||||
}) => {
|
||||
const osDark = useLocalState((state) => state.dark);
|
||||
@ -367,7 +370,11 @@ export const MessageAuthor = ({
|
||||
.unix(msg['time-sent'] / 1000)
|
||||
.format(DATESTAMP_FORMAT);
|
||||
const contact =
|
||||
`~${msg.author}` in contacts ? contacts[`~${msg.author}`] : false;
|
||||
( ( (msg.author === window.ship && showOurContact) ||
|
||||
msg.author !== window.ship) &&
|
||||
`~${msg.author}` in contacts
|
||||
) ? contacts[`~${msg.author}`] : false;
|
||||
|
||||
const showNickname = useShowNickname(contact);
|
||||
const { hideAvatars } = useSettingsState(selectCalmState);
|
||||
const shipName = showNickname ? contact.nickname : cite(msg.author);
|
||||
|
@ -207,7 +207,7 @@ class ChatWindow extends Component<
|
||||
api,
|
||||
association,
|
||||
group,
|
||||
contacts,
|
||||
showOurContact,
|
||||
graph,
|
||||
history,
|
||||
groups,
|
||||
@ -217,13 +217,14 @@ class ChatWindow extends Component<
|
||||
const messageProps = {
|
||||
association,
|
||||
group,
|
||||
contacts,
|
||||
showOurContact,
|
||||
unreadMarkerRef,
|
||||
history,
|
||||
api,
|
||||
groups,
|
||||
associations
|
||||
};
|
||||
|
||||
const msg = graph.get(index)?.post;
|
||||
if (!msg) return null;
|
||||
if (!this.state.initialized) {
|
||||
@ -254,6 +255,7 @@ class ChatWindow extends Component<
|
||||
msg,
|
||||
...messageProps
|
||||
};
|
||||
|
||||
return (
|
||||
<ChatMessage
|
||||
key={index.toString()}
|
||||
@ -275,6 +277,7 @@ class ChatWindow extends Component<
|
||||
history,
|
||||
groups,
|
||||
associations,
|
||||
showOurContact,
|
||||
pendingSize
|
||||
} = this.props;
|
||||
|
||||
@ -289,6 +292,10 @@ class ChatWindow extends Component<
|
||||
};
|
||||
const unreadMsg = graph.get(this.state.unreadIndex);
|
||||
|
||||
// hack to force a re-render when we toggle showing contact
|
||||
const contactsModified =
|
||||
showOurContact ? 0 : 100;
|
||||
|
||||
return (
|
||||
<Col height='100%' overflow='hidden' position='relative'>
|
||||
<UnreadNotice
|
||||
@ -314,7 +321,7 @@ class ChatWindow extends Component<
|
||||
onScroll={this.onScroll}
|
||||
data={graph}
|
||||
size={graph.size}
|
||||
pendingSize={pendingSize}
|
||||
pendingSize={pendingSize + contactsModified}
|
||||
id={association.resource}
|
||||
averageHeight={22}
|
||||
renderer={this.renderer}
|
||||
|
Loading…
Reference in New Issue
Block a user