Skip to content

Commit 858837b

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

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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)