You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It works fine, I mean I can get all messages (incoming, outgoing) from a message thread.
But I want to get a list of Threads, based on Messages.
Like, Thread which has most recent message should be on top, and least recent thread to the bottom.
I'm sure it's not the best solution for messaging, seems too hacky, but this is what I could come up with.
Please suggest some way to sort the threads, or maybe suggest something different all together.
Thanks.
The text was updated successfully, but these errors were encountered:
Thanks for the issue. To be honest, currently I can only come up with trickier solutions with subqueries.
But it might be possible to get a very clean solution with the HasOne feature request in the following issue: !11
I hope I find the time to look into that in the following weeks, but I'm not so sure. If you are motivated, you can also provide a PR for the HasOne relation suggestion.
@Aniket-IN Please check out if !13 resolves your problem. It is currently not perfect and I'll add more tests, but I think it is stable enough to test the use case.
In my application,
I have
MessageThread
andMessage
model.This is the migration for
message_threads
table:And
messages
With that, I have relations like this in
MessageThread
:It works fine, I mean I can get all messages (incoming, outgoing) from a message thread.
But I want to get a list of Threads, based on Messages.
Like, Thread which has most recent message should be on top, and least recent thread to the bottom.
I'm sure it's not the best solution for messaging, seems too hacky, but this is what I could come up with.
Please suggest some way to sort the threads, or maybe suggest something different all together.
Thanks.
The text was updated successfully, but these errors were encountered: