Skip to content

Commit 06bf4a5

Browse files
committed
Do not resolve channel_id.
1 parent 98e515a commit 06bf4a5

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

.rubocop_todo.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2025-02-08 15:48:35 UTC using RuboCop version 1.26.1.
3+
# on 2025-02-08 15:52:13 UTC using RuboCop version 1.26.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -47,7 +47,7 @@ Lint/RedundantCopDisableDirective:
4747
# Offense count: 13
4848
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
4949
Metrics/AbcSize:
50-
Max: 61
50+
Max: 58
5151

5252
# Offense count: 6
5353
# Configuration parameters: IgnoredMethods.
@@ -57,7 +57,7 @@ Metrics/CyclomaticComplexity:
5757
# Offense count: 15
5858
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
5959
Metrics/MethodLength:
60-
Max: 37
60+
Max: 35
6161

6262
# Offense count: 1
6363
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
@@ -106,7 +106,7 @@ RSpec/ContextMethod:
106106
RSpec/ContextWording:
107107
Enabled: false
108108

109-
# Offense count: 69
109+
# Offense count: 70
110110
# Configuration parameters: CountAsOne.
111111
RSpec/ExampleLength:
112112
Max: 18
@@ -117,13 +117,13 @@ RSpec/ExampleLength:
117117
RSpec/FilePath:
118118
Enabled: false
119119

120-
# Offense count: 69
120+
# Offense count: 70
121121
# Configuration parameters: .
122122
# SupportedStyles: have_received, receive
123123
RSpec/MessageSpies:
124124
EnforcedStyle: receive
125125

126-
# Offense count: 94
126+
# Offense count: 95
127127
RSpec/MultipleExpectations:
128128
Max: 5
129129

lib/slack/web/api/helpers/files.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,12 @@ def files_upload_v2(params = {})
4545
complete_upload_request_params[:channels] = Array(params[:channels]).map do |channel|
4646
conversations_id(channel: channel)['channel']['id']
4747
end.uniq.join(',')
48-
elsif params[:channel_id]
49-
complete_upload_request_params[:channel_id] = conversations_id(
50-
channel: params[:channel_id]
51-
)['channel']['id']
5248
elsif params[:channel]
5349
complete_upload_request_params[:channel] = conversations_id(
5450
channel: params[:channel]
5551
)['channel']['id']
52+
elsif params[:channel_id]
53+
complete_upload_request_params[:channel_id] = params[:channel_id]
5654
end
5755

5856
content = params[:content]

spec/slack/web/api/endpoints/custom_specs/files_spec.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
end.to raise_error ArgumentError, 'Only one of :channel, :channels, or :channel_id is required'
5858
end
5959

60-
%i[channel channel_id channels].each do |arg|
60+
%i[channel channels].each do |arg|
6161
it "completes the upload with #{arg}", vcr: { cassette_name: "web/files_upload_v2_#{arg}" } do
6262
expect(client.files_upload_v2(
6363
filename: 'test.txt',
@@ -88,6 +88,15 @@
8888
end
8989
end
9090

91+
it 'completes the upload with channel_id', vcr: { cassette_name: 'web/files_upload_v2_channel_id' } do
92+
expect(client).not_to receive(:conversations_list)
93+
expect(client.files_upload_v2(
94+
filename: 'test.txt',
95+
content: 'Test File Contents',
96+
channel_id: 'C08AZ76CA4V'
97+
).files.size).to eq 1
98+
end
99+
91100
context 'when using a list for channels', vcr: { cassette_name: 'web/files_upload_v2_with_channels_list' } do
92101
it 'completes the upload' do
93102
expect(client.files_upload_v2(

0 commit comments

Comments
 (0)