From bddcfd56c68bbb05a8423deb2c2788e2b733bd58 Mon Sep 17 00:00:00 2001 From: fang Date: Thu, 30 May 2024 22:48:02 +0200 Subject: [PATCH] summarize: work with latest dependencies Some of the types have changed subtle, so we make sure to pull in the latest versions of the sur files, and update the types we use to match. --- desk/lib/summarize.hoon | 18 +++++----- desk/sur/channels.hoon | 80 +++++++++++++++++++++++++++++++++++++---- desk/sur/chat.hoon | 28 ++++++++------- desk/sur/groups.hoon | 25 +++++++------ 4 files changed, 112 insertions(+), 39 deletions(-) diff --git a/desk/lib/summarize.hoon b/desk/lib/summarize.hoon index 90773fb0..4121c2fa 100644 --- a/desk/lib/summarize.hoon +++ b/desk/lib/summarize.hoon @@ -37,21 +37,21 @@ == %+ roll %~ tap by - .^ channels:c + .^ channels-0:c %gx (scry-path %channels /channels/channels) == - |= [[n=nest:c channel:c] g=(map flag:groups @ud) s=@ud r=@ud] + |= [[n=nest:c channel-0:c] g=(map flag:groups @ud) s=@ud r=@ud] ?. ?=(%chat kind.n) [g s r] - =+ .^ paged-posts:c + =+ .^ paged-simple-posts:c %gx %+ scry-path %channels - /chat/(scot %p ship.n)/[name.n]/posts/newer/(scot %ud (sub now range))/(scot %ud limit)/outline/channel-posts + /chat/(scot %p ship.n)/[name.n]/posts/newer/(scot %ud (sub now range))/(scot %ud limit)/outline/channel-simple-posts == :- %+ ~(put by g) group.perm - (add (~(gut by g) group.perm 0) (wyt:on-posts:c posts)) - %+ roll (tap:on-posts:c posts) - |= [[id-post:c p=(unit post:c)] s=_s r=_r] + (add (~(gut by g) group.perm 0) (wyt:on-simple-posts:c posts)) + %+ roll (tap:on-simple-posts:c posts) + |= [[id-post:c p=(unit simple-post:c)] s=_s r=_r] ?~ p [s r] ?:(=(our author.u.p) [+(s) r] [s +(r)]) :: @@ -115,9 +115,9 @@ =/ [duc=@ud faz=(list [g=flag:groups n=nest:c u=@ud])] %+ roll %~ tap by - .^(channels:c %gx (scry-path %channels /channels/channels)) + .^(channels-0:c %gx (scry-path %channels /channels/channels)) =+ .^(=unreads:c %gx (scry-path %channels /unreads/channel-unreads)) - |= [[n=nest:c channel:c] duc=@ud faz=(list [flag:groups nest:c @ud])] + |= [[n=nest:c channel-0:c] duc=@ud faz=(list [flag:groups nest:c @ud])] ?. ?=(%chat kind.n) [duc faz] :: ignore non-chat channels for now =/ =unread:c (~(gut by unreads) n *unread:c) :- (add duc count.unread) diff --git a/desk/sur/channels.hoon b/desk/sur/channels.hoon index 2db94219..ef034141 100644 --- a/desk/sur/channels.hoon +++ b/desk/sur/channels.hoon @@ -60,6 +60,7 @@ =remark =window =future + pending=pending-messages == -- :: $v-post: a channel post @@ -71,7 +72,7 @@ ++ mo-v-posts ((mp id-post (unit v-post)) lte) :: $v-reply: a post comment :: -+$ v-reply [v-reply-seal memo] ++$ v-reply [v-reply-seal (rev memo)] +$ id-reply time +$ v-replies ((mop id-reply (unit v-reply)) lte) ++ on-v-replies ((on id-reply (unit v-reply)) lte) @@ -198,11 +199,23 @@ :: $react: either an emoji identifier like :diff or a URL for custom +$ react @ta +$ v-reacts (map ship (rev (unit react))) ++$ client-id [author=ship sent=time] ++$ pending-posts (map client-id essay) ++$ pending-replies (map [top=id-post id=client-id] memo) ++$ pending-messages + $: posts=pending-posts + replies=pending-replies + == +:: $scam: bounded search results ++$ scam + $: last=(unit id-post) :: last (top-level) message that was searched + =scan :: search results + == :: $scan: search results +$ scan (list reference) +$ reference - $% [%post =post] - [%reply =id-post =reply] + $% [%post post=simple-post] + [%reply =id-post reply=simple-reply] == :: $said: used for references +$ said (pair nest reference) @@ -228,10 +241,11 @@ +$ unread $: recency=time count=@ud - unread-id=(unit id-post) - threads=(map id-post id-reply) + unread=(unit [id=id-post count=@ud]) + threads=(map id-post [id=id-reply count=@ud]) == :: $remark: markers representing unread state +:: recency: time of most recent message :: last-read: time at which the user last read this channel :: watching: unused, intended for disabling unread accumulation :: unread-threads: threads that contain unread messages @@ -355,6 +369,7 @@ :: +$ c-reply $% [%add =memo] + [%edit id=id-reply =memo] [%del id=id-reply] c-react == @@ -397,6 +412,7 @@ +$ r-channel $% [%posts =posts] [%post id=id-post =r-post] + [%pending id=client-id =r-pending] [%order order=arranged-posts] [%view =view] [%sort =sort] @@ -415,10 +431,32 @@ [%essay =essay] == :: ++$ r-pending + $% [%post =essay] + [%reply top=id-post =reply-meta =memo] + == +$ r-reply $% [%set reply=(unit reply)] [%reacts =reacts] == +:: ++$ r-channels-simple-post [=nest =r-channel-simple-post] ++$ r-channel-simple-post + $% $<(?(%posts %post) r-channel) + [%posts posts=simple-posts] + [%post id=id-post r-post=r-simple-post] + == +:: ++$ r-simple-post + $% $<(?(%set %reply) r-post) + [%set post=(unit simple-post)] + [%reply id=id-reply =reply-meta r-reply=r-simple-reply] + == +:: ++$ r-simple-reply + $% $<(%set r-reply) + [%set reply=(unit simple-reply)] + == :: versions of backend types with their revision numbers stripped, :: because the frontend shouldn't care to learn those. :: @@ -433,29 +471,57 @@ =perm == :: + +$ local + $: =net + =remark + pending=pending-messages + == + -- ++$ channels-0 (map nest channel-0) +++ channel-0 + |^ ,[global:channel local] +$ local $: =net =remark == -- ++$ channel-heads (list [=nest recency=time latest=(unit post)]) +$ paged-posts $: =posts newer=(unit time) older=(unit time) total=@ud == ++$ paged-simple-posts + $: posts=simple-posts + newer=(unit time) + older=(unit time) + total=@ud + == +$ posts ((mop id-post (unit post)) lte) -+$ post [seal essay] ++$ simple-posts ((mop id-post (unit simple-post)) lte) ++$ post [seal [rev=@ud essay]] ++$ simple-post [simple-seal essay] +$ seal $: id=id-post =reacts =replies =reply-meta == ++$ simple-seal + $: id=id-post + =reacts + replies=simple-replies + =reply-meta + == +$ reacts (map ship react) -+$ reply [reply-seal memo] ++$ reply [reply-seal [rev=@ud memo]] ++$ simple-reply [reply-seal memo] +$ replies ((mop id-reply reply) lte) ++$ simple-replies ((mop id-reply simple-reply) lte) +$ reply-seal [id=id-reply parent-id=id-post =reacts] ++ on-posts ((on id-post (unit post)) lte) +++ on-simple-posts ((on id-post (unit simple-post)) lte) ++ on-replies ((on id-reply reply) lte) +++ on-simple-replies ((on id-reply simple-reply) lte) -- diff --git a/desk/sur/chat.hoon b/desk/sur/chat.hoon index 9aa1d147..d93ae75e 100644 --- a/desk/sur/chat.hoon +++ b/desk/sur/chat.hoon @@ -1,12 +1,6 @@ -/- g=groups, d=channels, dos=chat-2, uno=chat-1, zer=chat-0 +/- g=groups, d=channels /- meta |% -++ old - |% - ++ zero zer - ++ one uno - ++ two dos - -- :: :: $id: an identifier for chat messages +$ id (pair ship time) @@ -16,6 +10,11 @@ +$ reply [reply-seal memo:d] :: $react: either an emoji identifier like :wave: or a URL for custom +$ react @ta +:: $scam: bounded search results ++$ scam + $: last=(unit time) :: last (top-level) msg (local) id that was searched + =scan :: search results + == :: $scan: search results +$ scan (list reference) :: $blocked: a set of ships that the user has blocked @@ -77,11 +76,12 @@ :: +$ paged-writs $: =writs - newer=(unit id) - older=(unit id) + newer=(unit time) + older=(unit time) total=@ud == :: ++$ chat-heads (list [=whom recency=time latest=(unit writ)]) :: $writs: a set of time ordered chat messages :: ++ writs @@ -229,10 +229,12 @@ [%club p=id:club] == :: ++$ message-key [=id =time] +:: :: $unreads: a map of club/dm unread information :: -:: unread: the last time a message was read, how many messages since, -:: and the id of the last read message +:: unread: the time of the most recent message, how many messages since, +:: the id of the last read message, and the set of unread threads :: ++ unreads =< unreads @@ -242,8 +244,8 @@ +$ unread $: recency=time count=@ud - unread-id=(unit id) - threads=(map id id) + unread=(unit [message-key count=@ud]) + threads=(map message-key [message-key count=@ud]) == +$ update (pair whom unread) diff --git a/desk/sur/groups.hoon b/desk/sur/groups.hoon index eca00f57..c28f45b2 100644 --- a/desk/sur/groups.hoon +++ b/desk/sur/groups.hoon @@ -1,9 +1,6 @@ /- meta, e=epic -/- old=group -/- grp=group-store -/- metadata-store |% -++ okay `epic:e`2 +++ okay `epic:e`3 ++ mar |% ++ act `mark`(rap 3 %group-action '-' (scot %ud okay) ~) @@ -17,7 +14,7 @@ :: :: $nest: ID for a channel, {app}/{ship}/{name} :: -+$ nest (pair dude:gall flag) ++$ nest (pair term flag) :: :: $sect: ID for cabal, similar to a role :: @@ -145,8 +142,10 @@ =cordon secret=? meta=data:meta + =flagged-content == :: ++$ group-ui [group saga=(unit saga:e)] :: $cabal: metadata representing a $sect or role :: ++ cabal @@ -256,6 +255,7 @@ [%secret p=?] [%create p=group] [%del ~] + [%flag-content =nest =post-key src=ship] == :: :: $action: the complete set of data required to edit a group @@ -283,6 +283,9 @@ :: +$ init [=time =group] :: +:: $groups-ui: map for frontend to display groups ++$ groups-ui + (map flag group-ui) +$ groups (map flag group) +$ net-groups @@ -304,6 +307,13 @@ [%sub p=time load=_| =saga:e] == :: ++$ post-key [post=time reply=(unit time)] +:: ++$ flaggers (set ship) +:: $flagged-content: flagged posts and replies that need admin review +:: ++$ flagged-content (map nest (map post-key flaggers)) +:: :: $join: a join request, can elect to join all channels :: +$ join @@ -352,9 +362,4 @@ == :: +$ gangs (map flag gang) -++ met metadata-store -:: -+$ import [self=association:met chan=(map flag =association:met) roles=(set flag) =group:old] -:: -+$ imports (map flag import) --