mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-10 10:05:09 +03:00
chat-view: support %groupify
This upgrades an existing, unmanaged village chat into a full-fledged group plus chat.
This commit is contained in:
parent
b77ab0f122
commit
9793dccef0
@ -245,6 +245,46 @@
|
||||
(permission-hook-poke [%add-synced ship.act group-path])
|
||||
(metadata-hook-poke [%add-synced ship.act group-path])
|
||||
==
|
||||
::
|
||||
%groupify
|
||||
?> ?=([%'~' ^] app-path.act)
|
||||
=/ data=(unit mailbox)
|
||||
(scry-for (unit mailbox) %chat-store [%mailbox app-path.act])
|
||||
?~ data
|
||||
~& [%cannot-groupify-nonexistent app-path.act]
|
||||
~
|
||||
=/ permission=(unit permission)
|
||||
(scry-for (unit permission) %permission-store [%permission app-path.act])
|
||||
?: |(?=(~ permission) ?=(%black kind.u.permission))
|
||||
~& [%cannot-groupify-blacklist app-path.act]
|
||||
~
|
||||
=/ =metadata
|
||||
=- (fall - *metadata)
|
||||
%^ scry-for (unit metadata)
|
||||
%metadata-store
|
||||
=/ encoded-path=@ta
|
||||
(scot %t (spat app-path.act))
|
||||
/metadata/[encoded-path]/chat/[encoded-path]
|
||||
=/ new-path=^path (slag 1 `path`app-path.act)
|
||||
=/ members=(set ship)
|
||||
%+ fall
|
||||
(group-scry app-path.act)
|
||||
*(set ship)
|
||||
=/ cards-1=(list card)
|
||||
(poke-chat-view-action %delete app-path.act)
|
||||
=/ cards-2=(list card)
|
||||
%- poke-chat-view-action
|
||||
:* %create
|
||||
title.metadata
|
||||
description.metadata
|
||||
new-path
|
||||
new-path
|
||||
%village
|
||||
members
|
||||
&
|
||||
==
|
||||
%+ snoc (weld cards-1 cards-2)
|
||||
(chat-poke %messages new-path envelopes.u.data)
|
||||
==
|
||||
::
|
||||
++ create-chat
|
||||
|
@ -258,6 +258,7 @@
|
||||
:~ [%create create]
|
||||
[%delete delete]
|
||||
[%join join]
|
||||
[%groupify groupify]
|
||||
==
|
||||
::
|
||||
++ create
|
||||
@ -281,6 +282,9 @@
|
||||
[%ask-history bo]
|
||||
==
|
||||
::
|
||||
++ groupify
|
||||
(ot [%app-path pa] ~)
|
||||
::
|
||||
++ sec
|
||||
=, dejs:format
|
||||
^- $-(json rw-security)
|
||||
|
@ -12,5 +12,12 @@
|
||||
==
|
||||
[%delete app-path=path]
|
||||
[%join =ship app-path=path ask-history=?]
|
||||
:: %groupify: for unmanaged %village chats: recreate as group-based chat
|
||||
::
|
||||
:: will delete the old chat, recreate it based on a proper group,
|
||||
:: and invite the current whitelist to that group.
|
||||
:: existing messages get moved over.
|
||||
::
|
||||
[%groupify app-path=path]
|
||||
==
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user