mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 13:54:20 +03:00
Merge remote-tracking branch 'origin/master' into release/next-sys
This commit is contained in:
commit
023640856f
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:35dab0c5d317e753c3f7baa3f95823bc5a75ac968c8791ef571f654880e1a88a
|
||||
size 8002166
|
||||
oid sha256:7fb70440761b73c2aa4a83e3f289e4b71875d8f9722f185baf059e4264826e42
|
||||
size 8129383
|
||||
|
@ -5,7 +5,7 @@
|
||||
/- glob
|
||||
/+ default-agent, verb, dbug
|
||||
|%
|
||||
++ hash 0v3.e7ep6.1ki6b.qpuiq.22qs6.qcbi7
|
||||
++ hash 0vada5t.b1gqn.oo4ga.6o12h.ek1ot
|
||||
+$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))]
|
||||
+$ all-states
|
||||
$% state-0
|
||||
|
@ -257,20 +257,7 @@
|
||||
?& !(~(has by archive) resource)
|
||||
!(~(has by graphs) resource)
|
||||
== ==
|
||||
=/ old-graph=(unit marked-graph:store)
|
||||
(~(get by graphs) resource)
|
||||
?> (validate-graph graph mark)
|
||||
=/ clay-backup=(list card)
|
||||
?~ old-graph ~
|
||||
=/ =wire
|
||||
backup+(en-path:res resource)
|
||||
=/ =update:store
|
||||
[%0 now.bowl %add-graph resource p.u.old-graph q.u.old-graph %.y]
|
||||
=/ =cage
|
||||
graph-update+!>(update)
|
||||
=/ =soba:clay
|
||||
[(welp wire /[(scot %da now.bowl)]/graph-update) ins+cage]~
|
||||
[%pass wire %arvo %c %info %home &+soba]~
|
||||
:_ %_ state
|
||||
graphs (~(put by graphs) resource [graph mark])
|
||||
update-logs (~(put by update-logs) resource (gas:orm-log ~ ~))
|
||||
@ -283,7 +270,6 @@
|
||||
%- zing
|
||||
:~ (give [/keys ~] %keys (~(put in ~(key by graphs)) resource))
|
||||
(give [/updates ~] %add-graph resource *graph:store mark overwrite)
|
||||
clay-backup
|
||||
?~ mark ~
|
||||
?: (~(has in validators) u.mark) ~
|
||||
=/ wire /validator/[u.mark]
|
||||
@ -311,6 +297,8 @@
|
||||
|^
|
||||
=/ [=graph:store mark=(unit mark:store)]
|
||||
(~(got by graphs) resource)
|
||||
~| "cannot add duplicate nodes to {<resource>}"
|
||||
?< (check-for-duplicates graph ~(key by nodes))
|
||||
=/ =update-log:store (~(got by update-logs) resource)
|
||||
=. update-log
|
||||
(put:orm-log update-log time [%0 time [%add-nodes resource nodes]])
|
||||
@ -325,6 +313,31 @@
|
||||
(add-node-list resource graph mark (sort-nodes nodes))
|
||||
==
|
||||
::
|
||||
++ check-for-duplicates
|
||||
|= [=graph:store nodes=(set index:store)]
|
||||
^- ?
|
||||
=/ node-list ~(tap in nodes)
|
||||
|-
|
||||
?~ node-list %.n
|
||||
?: (has-node graph i.node-list) %.y
|
||||
$(node-list t.node-list)
|
||||
::
|
||||
++ has-node
|
||||
|= [=graph:store =index:store]
|
||||
^- ?
|
||||
=/ node=(unit node:store) ~
|
||||
|-
|
||||
?~ index
|
||||
?=(^ node)
|
||||
?~ t.index
|
||||
?=(^ (get:orm graph i.index))
|
||||
=. node (get:orm graph i.index)
|
||||
?~ node %.n
|
||||
?- -.children.u.node
|
||||
%empty %.n
|
||||
%graph $(graph p.children.u.node, index t.index)
|
||||
==
|
||||
::
|
||||
++ sort-nodes
|
||||
|= nodes=(map index:store node:store)
|
||||
^- (list [index:store node:store])
|
||||
|
@ -24,6 +24,6 @@
|
||||
<div id="portal-root"></div>
|
||||
<script src="/~landscape/js/channel.js"></script>
|
||||
<script src="/~landscape/js/session.js"></script>
|
||||
<script src="/~landscape/js/bundle/index.47da5d209b0117cee942.js"></script>
|
||||
<script src="/~landscape/js/bundle/index.9b0a67d07399229dd21d.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -144,12 +144,12 @@ export default class ChatMessage extends Component<ChatMessageProps> {
|
||||
style={style}
|
||||
mb={1}
|
||||
>
|
||||
{dayBreak && !isLastRead ? <DayBreak when={msg.when} /> : null}
|
||||
{dayBreak && !isLastRead ? <DayBreak when={msg['time-sent']} /> : null}
|
||||
{renderSigil
|
||||
? <MessageWithSigil {...messageProps} />
|
||||
: <MessageWithoutSigil {...messageProps} />}
|
||||
<Box flexShrink={0} fontSize={0} position='relative' width='100%' overflow='visible' style={unreadContainerStyle}>{isLastRead
|
||||
? <UnreadMarker dayBreak={dayBreak} when={msg.when} ref={unreadMarkerRef} />
|
||||
? <UnreadMarker dayBreak={dayBreak} when={msg['time-sent']} ref={unreadMarkerRef} />
|
||||
: null}</Box>
|
||||
</Box>
|
||||
);
|
||||
@ -261,6 +261,8 @@ export class MessageWithSigil extends PureComponent<MessageProps> {
|
||||
measure={measure}
|
||||
fontSize={fontSize}
|
||||
group={group}
|
||||
hideNicknames={hideNicknames}
|
||||
hideAvatars={hideAvatars}
|
||||
/>)}
|
||||
</ContentBox>
|
||||
</Box>
|
||||
@ -276,16 +278,25 @@ const ContentBox = styled(Box)`
|
||||
|
||||
`;
|
||||
|
||||
export const MessageWithoutSigil = ({ timestamp, contacts, msg, remoteContentPolicy, measure, group }) => (
|
||||
export const MessageWithoutSigil = ({ timestamp, contacts, msg, remoteContentPolicy, measure, group, hideNicknames, hideAvatars }) => (
|
||||
<>
|
||||
<Text flexShrink={0} mono gray display='inline-block' pt='2px' lineHeight='tall' className="child">{timestamp}</Text>
|
||||
<ContentBox flexShrink={0} fontSize='14px' className="clamp-message" style={{ flexGrow: 1 }}>
|
||||
{msg.contents.map(c => (<MessageContent contacts={contacts} content={c} group={group} remoteContentPolicy={remoteContentPolicy} measure={measure}/>))}
|
||||
{msg.contents.map((c, i) => (
|
||||
<MessageContent
|
||||
key={i}
|
||||
contacts={contacts}
|
||||
content={c}
|
||||
group={group}
|
||||
remoteContentPolicy={remoteContentPolicy}
|
||||
measure={measure}
|
||||
hideNicknames={hideNicknames}
|
||||
hideAvatars={hideAvatars}/>))}
|
||||
</ContentBox>
|
||||
</>
|
||||
);
|
||||
|
||||
export const MessageContent = ({ content, contacts, remoteContentPolicy, measure, fontSize, group }) => {
|
||||
export const MessageContent = ({ content, contacts, remoteContentPolicy, measure, fontSize, group, hideNicknames, hideAvatars }) => {
|
||||
if ('code' in content) {
|
||||
return <CodeContent content={content} />;
|
||||
} else if ('url' in content) {
|
||||
@ -314,7 +325,7 @@ export const MessageContent = ({ content, contacts, remoteContentPolicy, measure
|
||||
} else if ('text' in content) {
|
||||
return <TextContent fontSize={fontSize} content={content} />;
|
||||
} else if ('mention' in content) {
|
||||
return <Mention group={group} ship={content.mention} contacts={contacts} />
|
||||
return <Mention group={group} ship={content.mention} contact={contacts?.[content.mention]} hideNicknames={hideNicknames} hideAvatars={hideAvatars} />
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -82,6 +82,8 @@ export function CommentItem(props: CommentItemProps) {
|
||||
group={group}
|
||||
content={post?.contents}
|
||||
remoteContentPolicy={remoteContentPolicy}
|
||||
hideNicknames={props.hideNicknames}
|
||||
hideAvatars={props.hideAvatars}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
|
@ -2,6 +2,7 @@ import React, { useState, useCallback } from "react";
|
||||
import _ from "lodash";
|
||||
import { Text, Box } from "@tlon/indigo-react";
|
||||
import {
|
||||
Contact,
|
||||
Contacts,
|
||||
Content,
|
||||
LocalUpdateRemoteContentPolicy,
|
||||
@ -13,13 +14,16 @@ import { ProfileOverlay } from "./ProfileOverlay";
|
||||
import {useHistory} from "react-router-dom";
|
||||
|
||||
interface MentionTextProps {
|
||||
contacts: Contacts;
|
||||
contact?: Contact;
|
||||
contacts?: Contacts;
|
||||
content: Content[];
|
||||
group: Group;
|
||||
remoteContentPolicy: LocalUpdateRemoteContentPolicy;
|
||||
hideNicknames: boolean;
|
||||
hideAvatars: boolean;
|
||||
}
|
||||
export function MentionText(props: MentionTextProps) {
|
||||
const { content, contacts, group } = props;
|
||||
const { content, contacts, contact, group, hideNicknames, hideAvatars } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -36,7 +40,7 @@ export function MentionText(props: MentionTextProps) {
|
||||
);
|
||||
} else if ("mention" in c) {
|
||||
return (
|
||||
<Mention key={idx} contacts={contacts || {}} group={group} ship={c.mention} />
|
||||
<Mention key={idx} contacts={contacts || {}} contact={contact || {}} group={group} ship={c.mention} hideNicknames={hideNicknames} hideAvatars={hideAvatars} />
|
||||
);
|
||||
}
|
||||
return null;
|
||||
@ -47,12 +51,18 @@ export function MentionText(props: MentionTextProps) {
|
||||
|
||||
export function Mention(props: {
|
||||
ship: string;
|
||||
contacts: Contacts;
|
||||
contact: Contact;
|
||||
contacts?: Contacts;
|
||||
group: Group;
|
||||
hideNicknames: boolean;
|
||||
hideAvatars: boolean;
|
||||
}) {
|
||||
const { contacts, ship } = props;
|
||||
const contact = contacts[ship];
|
||||
const showNickname = !!contact?.nickname;
|
||||
const { contacts, ship, hideNicknames, hideAvatars } = props;
|
||||
let { contact } = props;
|
||||
|
||||
contact = (contact?.nickname) ? contact : contacts?.[ship];
|
||||
|
||||
const showNickname = (Boolean(contact?.nickname) && !hideNicknames);
|
||||
const name = showNickname ? contact?.nickname : cite(ship);
|
||||
const [showOverlay, setShowOverlay] = useState(false);
|
||||
const onDismiss = useCallback(() => {
|
||||
@ -79,8 +89,8 @@ export function Mention(props: {
|
||||
color={`#${uxToHex(contact?.color ?? '0x0')}`}
|
||||
group={group}
|
||||
onDismiss={onDismiss}
|
||||
hideAvatars={false}
|
||||
hideNicknames={false}
|
||||
hideAvatars={hideAvatars || false}
|
||||
hideNicknames={hideNicknames}
|
||||
history={history}
|
||||
/>
|
||||
)}
|
||||
|
Loading…
Reference in New Issue
Block a user