Separate logic for user and community inbox #123
Loading…
Reference in New Issue
No description provided.
Delete Branch "rewrite-inbox"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Just pushing what I have so far. Still very much WIP.
Let me know if there's anything I can do for this.
@ -0,0 +215,4 @@
get_or_fetch_and_upsert_user(&user_id, &context, request_counter).await?;
Ok(())
}
Seems good to move this here.
This was pretty big and hard to follow, but I think I follow... its mostly extracting things from the shared inbox / other inboxes to the activity receive folders.
@ -0,0 +45,4 @@
// TODO: this file is for post/comment activities received by the community, and for post/comment
// activities announced by the community and received by the user. the name is terrible but
// i cant think of anything better.
Its fine to me.
@ -268,0 +119,4 @@
///
/// This doesnt handle the case where an activity is addressed to multiple communities (because
/// Lemmy doesnt generate such activities).
// TODO: this needs a better name
is_addressed_to seems fine to me, otherwise maybe
extract_local_community_from_to_and_ccs
or something.Thanks, I went with
extract_local_community_from_destinations()
and changed the others to return bool.@ -95,0 +141,4 @@
match activity_kind {
// Note, follow/unfollow are already handled earlier
CommunityValidTypes::Follow => {
// TODO: not sure what to do here, this was already handled before
Follow should probably be separate from the other communityvalidtypes... this is why we had the shared inbox be all public activities, and the user and community inboxes only be the private activities , following / unfollowing, sending a dm, etc.
Well the reason I split the inboxes is because it makes no sense to handle a
Create/Post
identical to anAnnounce/Create/Post
, they are quite different things. For example it is much easier to implement community bans now.Anyway I'm rewriting this in a better way.
@ -116,3 +167,1 @@
)
.await?;
res
// TODO: would be logical to move websocket notification code here
What do you think about separating the websocket notifications like this? It seems more logical to me to separate it from the receive logic, but most likely its too complicated cause every type of activity would have to be handled separately anyway.
As I said, the test case
A and G subscribe to B (center) A posts, G mentions B, it gets announced to A
needs to be fixed, then it can be squashed and merged.I also added a check to ensure that post, comment etc activities are addressed to public. This is to prevent the possibility of communities announcing private activities (eg private message) which they received by accident (or due to bugs).
By the way, we could merge the code for user_inbox, community_inbox and shared_inbox functions even more, because they are mostly identical.
Squashed this and fixed a bug in community removal. Still need to fix the test
A and G subscribe to B (center) A posts, G mentions B, it gets announced to A
(which I dont understand).WIP: Separate logic for user and community inboxto Separate logic for user and community inbox