Skip to content

Commit 010a0cc

Browse files
authored
Merge pull request #266 from dblock/removed-deprecated-hooks
Removed deprecated hooks.
2 parents 7c1c026 + 329a32c commit 010a0cc

File tree

5 files changed

+9
-27
lines changed

5 files changed

+9
-27
lines changed

CHANGELOG.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
### 0.16.0 (Next)
22

33
* [#263](https://github.com/slack-ruby/slack-ruby-bot/pull/263): Removed Giphy support - [@dblock](https://github.com/dblock).
4-
* [#260](https://github.com/slack-ruby/slack-ruby-bot/pull/260): Add brief migration guide - [@wasabigeek](https://github.com/wasabigeek).
4+
* [#260](https://github.com/slack-ruby/slack-ruby-bot/pull/260): Added a brief migration guide - [@wasabigeek](https://github.com/wasabigeek).
55
* [#264](https://github.com/slack-ruby/slack-ruby-bot/pull/264): Added TOC to README - [@dblock](https://github.com/dblock).
6-
* [#265](https://github.com/slack-ruby/slack-ruby-bot/pull/265): Make `allow_bot_messages` and `allow_message_loops` available in `SlackRubyBot::Client` - [@dblock](https://github.com/dblock).
6+
* [#265](https://github.com/slack-ruby/slack-ruby-bot/pull/265): Made `allow_bot_messages` and `allow_message_loops` available in `SlackRubyBot::Client` - [@dblock](https://github.com/dblock).
7+
* [#266](https://github.com/slack-ruby/slack-ruby-bot/pull/266): Removed deprecated `Server#hooks` - [@dblock](https://github.com/dblock).
78
* Your contribution here.
89

910
### 0.15.0 (2020/5/8)

README.md

-14
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ If you are not familiar with Slack bots or Slack API concepts, you might want to
3939
- [Hooks registration on SlackRubyBot::Server initialization](#hooks-registration-on-slackrubybotserver-initialization)
4040
- [Hooks registration on a SlackRubyBot::Server instance](#hooks-registration-on-a-slackrubybotserver-instance)
4141
- [Hooks registration on SlackRubyBot::Server class](#hooks-registration-on-slackrubybotserver-class)
42-
- [Deprecated hook registration](#deprecated-hook-registration)
4342
- [Bot Message Protection](#bot-message-protection)
4443
- [Message Loop Protection](#message-loop-protection)
4544
- [Logging](#logging)
@@ -462,19 +461,6 @@ These will get pushed into the hook set on initialization.
462461

463462
Either by configuration, explicit assignment or hook blocks, multiple handlers can exist for the same event type.
464463

465-
466-
#### Deprecated hook registration
467-
468-
Registering a hook method using `hooks.add` is considered deprecated and
469-
will be removed on future versions.
470-
471-
```ruby
472-
# [DEPRECATED]
473-
server.hooks.add(:hello, MyBot::Hooks::UserChange.new)
474-
server.hooks.add(:hello, ->(client, data) { puts "Hello!" })
475-
476-
```
477-
478464
### Bot Message Protection
479465

480466
By default bots do not respond to self or other bots. If you wish to change that behavior globally, set `allow_bot_messages` to `true`.

UPGRADING.md

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ GIF, Giphy and other animated GIF support has been removed. Remove `gif` options
99

1010
See [#261](https://github.com/slack-ruby/slack-ruby-bot/issues/261) for details.
1111

12+
#### Removed deprecated `server.hooks`
13+
14+
The previously deprecated `SlackRubyBot::Server#hooks` has been removed.
15+
16+
See [#266](https://github.com/slack-ruby/slack-ruby-bot/issues/266) for details.
17+
1218
### Upgrading to >= 0.15.0
1319

1420
#### Set up VCR explicitly

lib/slack-ruby-bot/hooks/hook_support.rb

-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ def on(event_name, &block)
1818
end
1919
end
2020

21-
# Instance stuff
22-
def hooks
23-
warn Kernel.caller.first + ' [DEPRECATION] `hooks` method is deprecated. Please use `server.on` instead to register a hook.'
24-
_hooks
25-
end
26-
2721
def on(event_name, handler)
2822
_hooks.add(event_name, handler)
2923
end

spec/slack-ruby-bot/hooks/hook_support_spec.rb

-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@
5656
end
5757
end
5858

59-
describe '#hooks' do
60-
subject { super().new }
61-
it { expect(subject.hooks).to eq subject.send(:_hooks) }
62-
end
63-
6459
describe '#_hooks' do
6560
it 'returns a SlackRubyBot::Hooks::Set instance' do
6661
hooks_set = subject.new.send(:_hooks)

0 commit comments

Comments
 (0)