-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add reactions to conversation history #239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job👍
I left a few small comments.
@JsonProperty("count") | ||
Integer getCount(); | ||
@JsonProperty("users") | ||
List<String> getUser(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename this to getUsers
? I imagine the list is returned when multiple users reacted with the same emoji.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we won't need JsonProperty
annotation in this case.
@JsonProperty("name") | ||
String getName(); | ||
@JsonProperty("count") | ||
Integer getCount(); | ||
@JsonProperty("users") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tend to use @JsonProperty
only if the name of the method is different from JSON key.
In this case, we don't need to name each property explicitly since for example count
is automatically deserialized and stored in getCount
. That's the magic of the immutables.
@JsonProperty("name") | ||
String getName(); | ||
@JsonProperty("count") | ||
Integer getCount(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integer
-> int
"reactions": [ | ||
{ | ||
"name": "astonished", | ||
"count": 3, | ||
"users": [ "U061F7AUR", "U062F7AUR", "U063F7AUR"] | ||
}, | ||
{ | ||
"name": "facepalm", | ||
"count": 34, | ||
"users": [ "U061F7AUR", "U062F7AUR", "U063F7AUR", "U064F7AUR", "U065F7AUR" ] | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding these.
Can we also please make sure that these reactions are parsed in the corresponding integration test?
Thanks for the quick feedback @omotnyk. I addressed the previous comments so feel free to take a second look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all your work. I have one small comment left but everything LGTM 🚢
assertThat(response.getMessages().get(1).getReactions().size()).isEqualTo(2); | ||
assertThat(response.getMessages().get(1).getReactions().get(0).getName()).isEqualTo("astonished"); | ||
assertThat(response.getMessages().get(1).getReactions().get(0).getCount()).isEqualTo(3); | ||
assertThat(response.getMessages().get(3).getReactions().get(1).getUsers()).isEqualTo(Arrays.asList("U061F7AUR", "U062F7AUR", "U063F7AUR")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's either assert that facepalm
reaction is deserialized correctly here as well or remove it from the JSON fixture.
Added reactions to the
LiteMessage
model to be able to retrieve the list or reactions attached to a slack message.