Commit Graph

72 Commits

Author SHA1 Message Date
Liam Fitzgerald
ec03c29b72 chat-hook: fix variable name 2020-04-23 23:12:30 +10:00
Liam Fitzgerald
a978ca2b5a chat: autoleave on watch-ack 2020-04-21 07:50:27 +10:00
Liam Fitzgerald
e21f9d772a chat: leave chats associated with group on group leave
When a group is left, the permissions no longer exist and the mailbox
subscription is kicked. Before attempting to resubscribe, we simply
check if we still have permissions and if not, leave the chat.
2020-04-21 07:47:48 +10:00
Fang
9f42d420b3
chat-hook: remove incorrect comment
We do, in fact, use it. Implicitly, when reestablishing the subscription during
kick handling.
2020-04-18 13:13:08 +02:00
Fang
4c4858f198
chat-hook: clarify backlog wire handling logic 2020-04-16 01:44:36 +02:00
Fang
0f05ed3149
chat-hook: consistently pull backlog subs
We weren't accounting for backlog subscriptions with non-zero message
indexes in their wires. Now, we look through all of our outgoing
subscriptions to identify relevant backlog subscriptions, and leave all
of those.

The more proper fix here is to not include message indexes in the wire
in the first place, since we don't ever reuse that anywhere. But that's
a more invasive change, so we just leave a TODO for it instead.
2020-04-15 19:26:58 +02:00
Fang
084ce356a8
chat-hook: on %remove, try our best to pull subs
Previously, we were removing the relevant entry from the `synced` map
before calling `+pull-wire`, which requires an entry to still be there.
This lead to subscriptions not actually being pulled, commonly leading
to "subscribe wire not unique" errors on re-join.

In addition to fixing that, `%remove` actions now try to pull the
subscription regardless of whether they have an entry in the `synced`
map or not. `%leave` is always safe, and we might want to clean up
subscriptions that shouldn't be there anymore in the first place.
2020-04-15 16:29:26 +02:00
Logan Allen
b85697cbec chat-hook: respect backlog index, no longer truncate 2020-04-10 15:25:58 -04:00
Logan Allen
8cdfb559f6 chat-view and hook: style pass and backlog truncation 2020-04-10 15:25:58 -04:00
Logan Allen
ecc8942eaf chat: reversed order that messages are stored in for faster performance 2020-04-10 15:25:58 -04:00
Logan Allen
717b02ad6f chat: added jet hints 2020-04-02 17:43:03 -04:00
Fang
1e1c26e306
chat-hook: clean up pre-OS1 subscriptions
If chats with identical resource paths were created, that would result
in chat-hook seeing updates twice.

These "/mailbox wire sub to local chat-store" subscriptions aren't
created by the current logic anymore, and as such any existing ones
should be eradicated.
2020-03-20 17:56:17 +01:00
Fang
a162ab0e73
chat-hook: handle watch-nack for /store wires too
Similar to /backlog wires, we want to emulate %remove behavior on-nack.
2020-03-19 15:32:40 +01:00
Fang
62dfc5fd3c
chat-hook: clear all subscriptions on watch-nack
We would remove the entry from state, but not clean up its mailbox subscription.
2020-03-15 17:37:57 +01:00
Logan Allen
a0a39b87dc chat-hook: watch-ack successfully for store subscripttion kills 2020-03-11 23:13:31 -07:00
Isaac Visintainer
ba43f03726 chat-hook: resubscribe when kicked from chat-store 2020-03-11 22:21:56 -07:00
Logan Allen
84a9f23af6 chat-hook: fix ota chat backlog duplication 2020-03-11 20:43:41 -07:00
Logan Allen
cac98b2284 chat-hook: don't send invites upon on-load 2020-03-11 20:33:38 -07:00
Logan Allen
64a62df461 chat-hook: removed comments 2020-03-11 16:45:03 -07:00
Logan Allen
51eebf3407 chat-hook: send updates to synced every time the object changes 2020-03-11 16:45:01 -07:00
Logan Allen
64938e24e9 chat-hook: added ability to subscribe to chat-hook state from the frontend 2020-03-11 16:44:15 -07:00
Logan Allen
10e0dca58c chat-hook: ota fix and improvement on backlog fetching 2020-03-11 12:12:51 -07:00
Logan Allen
17bea9a5bd chat: only send invites for unmanaged chats 2020-03-09 16:44:16 -07:00
Logan Allen
e8c95157d4 chat-hook: emit cards upon upgrade AND store cards to be sent later upon chat-store trigger to support either order of updating 2020-03-09 12:40:04 -07:00
Logan Allen
3824402200 chat: upgraded chat-hook to move old chats to /~/chat-path
chat: ota attempt

chat: ota triggers chat-store to tell chat-hook to send cards to update chat-store's state

contact-view: commented out avatars and base64

chat: cleaned up commits
2020-03-08 13:05:10 -07:00
Logan Allen
0d69e17f3b apps: main backend integration between metadata and chat 2020-02-26 14:10:32 -08:00
Fang
82292cc152
chat-hook: on-migrate, only send invites for whitelists
Instead of also sending invites to blacklisted ships, which is obviously
incorrect.
2020-02-25 21:06:44 +01:00
Fang
53bc1d1996
chat-hook: on-migrate, send fresh invites
Accepting these post-upgrade should re-establish all the required
subscriptions. (But doesn't as of this commit, work still pending.)
2020-02-25 21:02:05 +01:00
Fang
d6da23f8c4
chat-hook: style touch-ups 2020-02-25 16:56:10 +01:00
Fang
51f1f9e3a2
chat-hook: on-migrate, delete permission-hook entry
If we don't host a group, we can't (locally) delete it, but we do still
have a permission-hook entry we want to clean up. This does that
deletion, but still relies on the permission-hook logic to clean it up
in the local group case.
2020-02-24 22:52:40 +01:00
Fang
e5525b7d9e
chat-hook: on-migrate, configure permission-hook also
Permissions for the new group need to be exposed to the members of those
new groups. This makes the on-migrate logic poke the permission-hook for
that.
2020-02-21 23:57:58 +01:00
Fang
c3becc9f5f
chat-hook: fall back if metadata-store not live
This temporary, upgrade-oriented logic depends on two assumptions:
- If the metadata-store is not running, we are still in the process of
  applying the upgrade.
- If the above is true, all chats are /~host/name, all groups are
  /~/~host/name, and they have a strict one-to-one relation.

Armed with those assumptions, we can deduce groups from chats and vice
versa without depending on the metadata-store, allowing us to carry on
as if it were already running.
2020-02-21 23:57:57 +01:00
Fang
4a45d2caa6
chat-hook: implement group/permission migration
We want to move from group/permission paths of the form /chat/~host/name
to /~/~host/name, merging the ./read and ./write permission paths into a
single permission matching the group path.
(The leading /~ signifies an "unmanaged" group, one used by apps
internally, and not explicitly exposed to the user as a contacts group.)

This upgrade logic does roughly the following, for every chat path, to
accomplish the migration:
1. delete ./read and ./write groups associated with the chat
2. create a new group containing an approximate "uni" of the old groups
3. register the chat + new group with the metadata-store
4. hook the group up to its matching permission set

Note that because existing groups are hooked up through the
permission-group-hook, doing step 1 deletes the associated permissions.
Step 4 then re-establishes that relation for the newly created group.

The logic here scries into the metadata-store, and as such depends on
that having been started prior to this upgrade process.
2020-02-21 00:50:17 +01:00
Fang
491ac5689f
chat-hook: use metadata-store for permission checks
When permissions change, find out which chats are impacted (on the
assumption that permission paths are group paths), then perform actions
wrt that chat accordingly.

When a chat is interacted with, find out which groups the chat is
associated with, then use those to perform permission checks. If the
check passes for any group, permission is granted.
2020-02-21 00:50:17 +01:00
Fang
9a9aaaaf17
chat-hook: add scry helper 2020-02-21 00:50:16 +01:00
Isaac Visintainer
00a9eb9eab Merge branch 'master' into os1-rc 2020-02-19 16:04:21 -08:00
Logan Allen
d7d7cc6f94 chat-hook: fix double invite bug 2020-02-11 11:47:34 -08:00
Fang
b876716f0d
chat-hook: evaluate result-less %code messages
Prior to sending them out to the messaging target.
2020-02-10 16:34:37 +01:00
Logan Allen
3e94033196 chat: auto-invite on addition to group 2020-02-07 15:52:55 -08:00
Logan Allen
64ff95d27c chat: backend work to support ~ paths 2020-02-06 16:01:00 -08:00
Logan Allen
b51ae958ec chat: fix issues with [ship path] to path change and support contacts 2020-02-04 15:31:06 -08:00
Logan Allen
543420b68e chat: cleanup to change api to accept path instead of ship, path 2020-02-04 15:30:02 -08:00
A Arroyo
5c8a53dcaa remove /read and /write dual group usage 2020-02-04 15:28:44 -08:00
Anthony Arroyo
a59e0a9ec7 remove chat prepending from groups 2020-02-04 15:28:44 -08:00
Fang
da6f27c55c
dbug: augment various apps with /lib/dbug
Also includes lib/verb where it wasn't being used yet.
2020-01-21 12:36:03 -08:00
Jared Tobin
01afc2a143
Merge branch 'm/gall-gift-paths' (#2134)
* origin/m/gall-gift-paths:
  gall: (list path) in %fact and %kick

Signed-off-by: Jared Tobin <jared@tlon.io>
2020-01-07 04:17:32 +08:00
Fang
fcf1846b6f
various: remove trailing whitespace 2020-01-03 22:06:42 +01:00
Fang
ae8a57ca25
gall: (list path) in %fact and %kick
Instead of providing a (unit path), allows for (list path), which better
supports the "update to path and subpath cases".

For example, if /things wants updates about everything, and
/things/specific wants updates about the specific thing, they'll both
need to receive a %fact when the specific thing changes.
Previously, these would have been two separate moves. Now, gall handles
the multi-targeting for you.
2019-12-23 13:37:32 +01:00
Fang
6722f789a9
chat-hook: no-op on /backlog kick if not synced
This matches the behavior that's used for +kick on /mailbox, among other flows.
2019-12-08 20:08:23 +01:00
Philip Monk
dc3c848ed7
chat-hook: remove printfs 2019-12-02 22:44:32 -08:00