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

lastMessage object does not return reactions and I explain why this is a problem #12214

Closed
rafaelks opened this issue Sep 28, 2018 · 0 comments
Closed

Comments

@rafaelks
Copy link
Contributor

rafaelks commented Sep 28, 2018

Description:

Here's a lastMessage with reactions coming from the rooms API endpoint:

{
      "t" : "d",
      "_updatedAt" : "2018-09-28T13:42:42.424Z",
      "_id" : "9dDK3Bfpq2j9TLRDthFcuvjJeHfNjeYAqQ",
      "lastMessage" : {
        "mentions" : [ ],
        "sandstormSessionId" : null,
        "u" : {
          "_id" : "9dDK3Bfpq2j9TLRDt",
          "name" : "Fullname Of The User",
          "username" : "rafaelks.test.2"
        },
        "_id" : "joFSJiaR7madn07H1t",
        "ts" : "2018-09-28T13:42:42.142Z",
        "rid" : "9dDK3Bfpq2j9TLRDthFcuvjJeHfNjeYAqQ",
        "unread" : true,
        "msg" : "Teste 2",
        "_updatedAt" : "2018-09-28T13:42:42.153Z",
        "channels" : [ ]
      }
}

Here's the message object, when coming from the list of messages:

{
        "mentions" : [],
        "u" : {
          "_id" : "9dDK3Bfpq2j9TLRDt",
          "name" : "Fullname Of The User",
          "username" : "rafaelks.test.2"
        },
        "_id" : "joFSJiaR7madn07H1t",
        "reactions" : {
          ":umbrella2:" : {
            "usernames" : [
              "rafaelks.test.2"
            ]
          }
        },
        "ts" : {
          "$date" : 1538142162142
        },
        "rid" : "9dDK3Bfpq2j9TLRDthFcuvjJeHfNjeYAqQ",
        "msg" : "Teste 2",
        "_updatedAt" : {
          "$date" : 1538145553439
        },
        "channels" : [ ]
}

The problem is that not having reactions in lastMessage would not be a big deal if when we request the message from the messages API it returned reactions: [] for an empty list. Today it doesn't return the property.

What's the problem? The only way we know today if the reactions list is empty or not is because the property is not being returned (both APIs). Problem is that if we don't have that on the lastMessage, it will remove the reactions from the database and then when the user opens the list of message the reactions are gone.

My question for you guys is: can we apply any of this proposals in order to get this consistent?

  1. Always return reactions in a message object;
  2. Always return reactions in the list of messages, even in the list of reactions is empty.
@tassoevan tassoevan changed the title [BUG] lastMessage object does not return reactions and I explain why this is a problem lastMessage object does not return reactions and I explain why this is a problem Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants