fix: fetching thread members #401
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Currently, fetching thread members is 100% broken no matter what. This is because the library accidentally calls
#collecton 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).API::Channel#list_thread_membersincorrectly accepts abeforeparameter when onlyafteris 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
beforeparameter is more dangerous than removing it. The API doesn't raise any error whenbeforeis passed, and thus when I was testing the method, it caused an infinite loop with thePaginator. 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 toAPI::Channel#list_thread_membersFixed
Channel#membersnow fetches all of the members who have joined a thread.