Skip to content

Conversation

@Droid00000
Copy link
Collaborator

Summary

Currently, fetching thread members is 100% broken no matter what. This is because the library accidentally calls #collect on a hash with a block arity of one. This returns an array of two-element arrays with each key/value pair in the hash (see below). Additionally, fetching thread members requires making REST calls which is currently not handed at all, as the code incorrectly assumes that all thread members for a thread will be cached (which is never the case because the gateway never provides this data up-front except for the current thread member).

irb(main):001> hash = { ruby: "stone", crystal: "rock" };

irb(main):002> hash.collect { |name| name }
=> [[:ruby, "stone"], [:crystal, "rock"]]

API::Channel#list_thread_members incorrectly accepts a before parameter when only after is actually supported by the API. I've made an effort to avoid making a breaking change, but due to the lack of documentation about how the method works, I've had to make a few assumptions.

This is technically a breaking change, but leaving the before parameter is more dangerous than removing it. The API doesn't raise any error when before is passed, and thus when I was testing the method, it caused an infinite loop with the Paginator. I strongly believe that this sort of issue is better just cut-off from the root, rather than someone finding out from their bot hanging forever, but it's ultimately your call.

Added

with_member: argument to API::Channel#list_thread_members

Fixed

Channel#members now fetches all of the members who have joined a thread.

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.

1 participant