Return user's own messages as well as the other's when getting private messages
enhancement
### Requirements
- [x] Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support or the [matrix chat](https://matrix.to/#/#lemmy:matrix.org).
- [x] Did you check to see if this issue already exists?
- [x] Is this only a feature request? Do not put multiple feature requests in one issue.
- [x] Is this a backend issue? Use the [lemmy-ui](https://github.com/LemmyNet/lemmy-ui) repo for UI / frontend issues.
- [x] Do you agree to follow the rules in our [Code of Conduct](https://join-lemmy.org/docs/code_of_conduct.html)?
### Is your proposal related to a problem?
In API v3, when you called /api/v3/private_message/list, along with a `creator_id` it would return the recipient's messages as well as your own.
This was useful, as it allowed frontends to display your own messages in a conversation with another person, which makes it significantly easier to understand context.
Now, with notifications unified, when you
- call getNotifications
- filtering by a given `creator_id`
- and filtering by `type_=private_message`,
it only returns the other user's messages. This makes logical sense, but if I wish to show my own messages for context, it requires 2 API requests, and most importantly it would fetch *my* messages with *anyone*, not just the recipient I want.
### Describe the solution you'd like.
I'd like a method to return my own messages as well as the other user's messages in a single API call, sorted normally.
Now that notifications are unified, this may be complex.
- Perhaps when filtering `type_` to `private_message`, it would automatically return your own messages as well, even if you specified a `creator_id`? This could be unintuitive though.
- Or maybe an extra field in the request like `own_messages: boolean`.
I just need the response to have a sorted list that combines messages from Me -> Other User, and from Other User -> Me.
### Describe alternatives you've considered.
I *could* make 2 API requests, filtering by my own user ID and the other user's ID, but this has problems with pageination and sorting, that were common among many mixed schemas in old API v3.
It would also require me to filter out my messages for ones that were sent to the Other User, which becomes hell if there's not enough on a certain page (need to make even more requests to find my messages to this user), etc.
### Additional context
_No response_
1 条评论