-
-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use conversations_list instead of deprecated channels_list #331
Merged
Merged
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
42d4c4d
Use conversations_list instead of deprecated channels_list
wasabigeek e3d7102
Revert "Use conversations_list instead of deprecated channels_list"
wasabigeek 3b61081
Add conversations_id method
wasabigeek 9a609d3
Change method template to use new method
wasabigeek 12db5c9
Include Conversations mixin
wasabigeek d6f7af7
Add back ActiveSupport for rake task
wasabigeek 0df5847
Update slack-api-ref subcommit
wasabigeek 6ac38dc
Reset methods for new slack-api-ref changes
wasabigeek d7f6790
Update chat.1.patch
wasabigeek 2547378
Incorporate old patches
wasabigeek 2bc605d
Update channels_info spec
wasabigeek 982db4b
Fix rubocop errors
wasabigeek 25a2428
Add changelog
wasabigeek c4c18b8
Formatting fixes
wasabigeek c7389e4
Fix danger changelog
wasabigeek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# frozen_string_literal: true | ||
require_relative 'mixins/channels.id' | ||
require_relative 'mixins/conversations.id' | ||
require_relative 'mixins/users.id' | ||
require_relative 'mixins/users.search' | ||
require_relative 'mixins/groups.id' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
require_relative 'ids.id' | ||
|
||
module Slack | ||
module Web | ||
module Api | ||
module Mixins | ||
module Conversations | ||
include Ids | ||
# | ||
# This method returns a channel ID given a channel name. | ||
# | ||
# @option options [channel] :channel | ||
# Channel to get ID for, prefixed with #. | ||
def conversations_id(options = {}) | ||
name = options[:channel] | ||
throw ArgumentError.new('Required arguments :channel missing') if name.nil? | ||
|
||
id_for(:channel, name, '#', :channels, 'channel_not_found') do | ||
conversations_list | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Submodule slack-api-ref
updated
17 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
require 'spec_helper' | ||
|
||
RSpec.describe Slack::Web::Api::Mixins::Conversations do | ||
subject(:conversations) do | ||
klass.new | ||
end | ||
|
||
let(:klass) do | ||
Class.new do | ||
include Slack::Web::Api::Mixins::Conversations | ||
end | ||
end | ||
|
||
before do | ||
allow(conversations).to receive(:conversations_list).and_return( | ||
Slack::Messages::Message.new( | ||
'channels' => [{ | ||
'id' => 'CDEADBEEF', | ||
'name' => 'general' | ||
}] | ||
) | ||
) | ||
end | ||
|
||
context '#conversations_id' do | ||
it 'leaves channels specified by ID alone' do | ||
expect(conversations.conversations_id(channel: 'C123456')).to( | ||
eq('ok' => true, 'channel' => { 'id' => 'C123456' }) | ||
) | ||
end | ||
it 'translates a channel that starts with a #' do | ||
expect(conversations.conversations_id(channel: '#general')).to( | ||
eq('ok' => true, 'channel' => { 'id' => 'CDEADBEEF' }) | ||
) | ||
end | ||
it 'fails with an exception' do | ||
expect { conversations.conversations_id(channel: '#invalid') }.to( | ||
raise_error(Slack::Web::Api::Errors::SlackError, 'channel_not_found') | ||
) | ||
end | ||
end | ||
end |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is perfect, fixes the regression in all cases.