Skip to content

Commit e9b95e0

Browse files
committed
Make conversation name -> id translation more efficient
1 parent af8828f commit e9b95e0

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
* [#549](https://github.com/slack-ruby/slack-ruby-client/pull/549): Add group ID formatting support for message mentions - [@n0h0](https://github.com/n0h0).
44
* [#553](https://github.com/slack-ruby/slack-ruby-client/pull/553): Use `secure_compare` during signature verification - [@hieuk09](https://github.com/hieuk09).
5+
* [#555](https://github.com/slack-ruby/slack-ruby-client/pull/555): More efficient name-to-ID translation - [@eizengan](https://github.com/eizengan).
56
* Your contribution here.
67

8+
79
### 2.5.2 (2025/02/19)
810

911
* [#548](https://github.com/slack-ruby/slack-ruby-client/pull/548): Fix: `files_upload_v2` with `#channel` - [@dblock](https://github.com/dblock).

lib/slack/web/api/mixins/conversations.id.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def conversations_id(options = {})
1616
name = options[:channel]
1717
raise ArgumentError, 'Required arguments :channel missing' if name.nil?
1818

19-
id_for :channel, name, '#', :conversations_list, :channels, 'channel_not_found'
19+
id_for :channel, name, '#', :conversations_list, :channels, 'channel_not_found', enum_method_options: { limit: 1_000 }
2020
end
2121
end
2222
end

lib/slack/web/api/mixins/ids.id.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ module Mixins
66
module Ids
77
private
88

9-
def id_for(key, name, prefix, enum_method, list_method, not_found_error)
9+
def id_for(key, name, prefix, enum_method, list_method, not_found_error, enum_method_options: {})
1010
return { 'ok' => true, key.to_s => { 'id' => name } } unless name[0] == prefix
1111

12-
public_send enum_method do |list|
12+
public_send(enum_method, **enum_method_options) do |list|
1313
list.public_send(list_method).each do |li|
1414
return Slack::Messages::Message.new('ok' => true, key.to_s => { 'id' => li.id }) if li.name == name[1..-1]
1515
end

0 commit comments

Comments
 (0)