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

Remove ListResponseItemMessage::message #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bobrippling
Copy link

The reaction_added and reaction_removed events don't have
message as a field, which was causing the deserialization to fail,
preventing upstream libraries from handling reactions.

fixes slack-rs/slack-rs#111

The [reaction_added] and [reaction_removed] events don't have this
as a field, which was causing the deserialization to fail, preventing
upstream libraries from handling reactions.

[reaction_added]: https://api.slack.com/events/reaction_added
[reaction_removed]: https://api.slack.com/events/reaction_removed
@dten
Copy link
Contributor

dten commented May 25, 2019

The code you've edited is generated from the schema. It's really round about but the proper change is to edit the schema, updated the the submodule in this repo, generate the code and pr

@bobrippling
Copy link
Author

Ah okay - I've opened a PR (slack-rs/slack-api-schemas#15) in the schema repo, although it looks like one of my fixes duplicates an existing PR (slack-rs/slack-api-schemas#8).

However, even with this schema update, the line
pub message: ::Message,
remains in src/mods/reactions.rs, preventing us from handling reaction messages.
:(

@dten
Copy link
Contributor

dten commented Jun 3, 2019

I'm trying to confirm this, which method are you trying to call that is failing?

@dten
Copy link
Contributor

dten commented Jun 3, 2019

i think the issue is related to this comment in the docs which imply the event version of the item does not contain as much info. So it looks like message is optional

Embedded item objects
Embedded item nodes are more lightweight than the structures you'll find in reactions.list.

looking further it's the reuse of the list items as the rtm items when they're really different types

@bobrippling
Copy link
Author

Yeah, I think making message optional is the right fix.

To reproduce the issue, I wrote an example in my fork of slack-rs, on the reaction-example branch. That branch uses this PR for its slack-rs-api dependency, and the example logs all reactions it receives.

If you check this out and run the reaction example, note that slack reactions are logged. Then if you revert the changes to Cargo.toml so it uses the upstream slack-rs-api code, you should see that reactions are no longer logged, as the on_event() method is never fired for them.

Let me know if you have any trouble with this.

@dten
Copy link
Contributor

dten commented Jun 4, 2019

Ah yes I did get a repro in the end. There are some other events also such as pin added that suffer from the same problem. Just trying to make sure they're all caught and will get it fixed.
Might expose an easy way to get the failures so I can have my app reporting all failures somewhere to be dealt with later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to parse reactions
2 participants