Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement message federation and redesign message view #830

Merged
merged 14 commits into from
Jun 30, 2024

Conversation

BentiGorlich
Copy link
Member

@BentiGorlich BentiGorlich commented Jun 15, 2024

This PR implement federation for messages. They use the AP type ChatMessage which is not part of the AP standard, but is used by Lemmy and Pleroma. The main goal is interoperability with Lemmy.

  • message federation works between Mbin <-> Mbin
  • message federation works between Lemmy <-> Mbin
  • redesign message view
  • implement messaging with more than 2 participants
    Lemmy does not support it and we do not have a way of distinguishing between the lemmy and mbin servers. The backend works for multiple participants, but I did not add an option in the UI to start a thread with multiple participants. I want it to show a warning when a lemmy user is part of a multi thread
  • update activities from lemmy are working (editing)

Redesigned message view:

Overview:

Before After
grafik grafik

Chat:

Before After
grafik grafik

Only the middle part scrolls and the view will scroll to the bottom when loaded

- add a migration to add an uuid and an ap_id to the message table
- add a message controller to retrieve messages by their uuid
- remove the access denied exception when sending a message to a remote user
- add `Message` to the `ActivityFactory` so `CreateMessage`s can be dispatched for messages
- fix context endpoint so it is only one array with values
- make `ChainActivityHandler` handle messages as well
- give the message view a chat like style
- instead of using the `inReplyTo` field we just match the participants now, because lemmy doesn't support that
- fix wrong array building in `isActivityPublic` method
- remove `ChainActivityHandler` code for chat messages, since we do not have the `inReplyTo` field, the message will never bounce to it
@BentiGorlich BentiGorlich added enhancement New feature or request frontend Visual issues, improvements, bugs or other aspects relating mostly to the front end activitypub ActivityPub related issues backend Backend related issues and pull requests labels Jun 15, 2024
@BentiGorlich BentiGorlich self-assigned this Jun 15, 2024
@BentiGorlich
Copy link
Member Author

Mastodon private mentions will be implemented separately and will probably not use our message system, but will be represented as a normal post (regardless of which type) with a visibility of private.

@BentiGorlich
Copy link
Member Author

@nobodyatroot @e-five256 @melroy89 should I implement messages with more than 2 participants or is that too much for this PR? I don't think that lemmy supports it, but implementing it shouldn't be that hard. The rest of the code should already handle infinite number of participants

@ghost
Copy link

ghost commented Jun 19, 2024

@nobodyatroot @e-five256 @melroy89 should I implement messages with more than 2 participants or is that too much for this PR? I don't think that lemmy supports it, but implementing it shouldn't be that hard. The rest of the code should already handle infinite number of participants

that sounds like a cool Mbin specific thing as long as it doesn't break 2 participant message compatibility with lemmy. i'll leave it up to you if it's too much work for the PR since you're doing all the work ;-)

@BentiGorlich
Copy link
Member Author

I'll check if lemmy support breaks when there is more than one user in the to field. If Lemmy doesn't break, then I'll implement it, but I suspect, that Lemmy breaks 😅

- when a lemmy user edits a message it now gets applied
- improve messages front
- save the ap_id of incoming messages
- hide the sidebar when in mobile view (it previously got put at the end of the side, now it just gets hidden)
@BentiGorlich BentiGorlich marked this pull request as ready for review June 26, 2024 14:10
@melroy89

This comment was marked as outdated.

BentiGorlich and others added 4 commits June 29, 2024 21:34
@melroy89 melroy89 self-requested a review June 30, 2024 09:52

private function handlePrivateMentions(): void
{
// TODO implement private mentions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO left?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but for later, yes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure OK. I understand. I just wanted to point it out, you never know. right?

melroy89
melroy89 previously approved these changes Jun 30, 2024
Copy link
Member

@melroy89 melroy89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested again with BentiGorlich, still works with Mbin <> Mbin.

Copy link
Member

@melroy89 melroy89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still want to show form errors, but I approve the current PR as is.

@BentiGorlich BentiGorlich merged commit 4266dab into main Jun 30, 2024
7 checks passed
@BentiGorlich BentiGorlich deleted the new/message-federation branch June 30, 2024 11:08
@BentiGorlich BentiGorlich mentioned this pull request Aug 27, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
activitypub ActivityPub related issues backend Backend related issues and pull requests enhancement New feature or request frontend Visual issues, improvements, bugs or other aspects relating mostly to the front end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Looks like sending a message to someone on a different instance doesn't work
2 participants