Skip to content

Commit

Permalink
Only ping active teams for status.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Mar 10, 2023
1 parent fe1e119 commit d0d6a0f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
33 changes: 11 additions & 22 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
### Changelog

### 2/11/2016

* Implemented an OOB GC - [@dblock](https://github.com/dblock).
* Swapped Puma for Unicorn - [@dblock](https://github.com/dblock).
* Fix: wait for the EventMachine reactor to start - [@dblock](https://github.com/dblock).

### 1/21/2016

* Rebranded as Slack API Explorer - [@dblock](https://github.com/dblock).

### 1/15/2016

* Fix: respond to @bot - [@dblock](https://github.com/dblock).

### 1/6/2016

* [#1](https://github.com/slack-ruby/slack-api-explorer/issues/1): Added JSON processing - [@dblock](https://github.com/dblock).
* JSON output is now prettier - [@dblock](https://github.com/dblock).

### 1/5/2016

* Initial public release - [@dblock](https://github.com/dblock).
* 2023/01/16: Replaced Travis-CI with GHA - [@dblock](https://github.com/dblock).
* 2018/05/10: Use ERB instead of static pages - [@dblock](https://github.com/dblock).
* 2017/03/14: Use slack-ruby-bot-server - [@dblock](https://github.com/dblock).
* 2016/02/11: Implemented an OOB GC - [@dblock](https://github.com/dblock).
* 2016/02/11: Swapped Puma for Unicorn - [@dblock](https://github.com/dblock).
* 2016/02/11: Fix: wait for the EventMachine reactor to start - [@dblock](https://github.com/dblock).
* 2016/01/21: Rebranded as Slack API Explorer - [@dblock](https://github.com/dblock).
* 2016/01/15: Fix: respond to @bot - [@dblock](https://github.com/dblock).
* 2016/01/06: [#1](https://github.com/slack-ruby/slack-api-explorer/issues/1): Added JSON processing - [@dblock](https://github.com/dblock).
* 2016/01/06:JSON output is now prettier - [@dblock](https://github.com/dblock).
* 2016/01/05: Initial public release - [@dblock](https://github.com/dblock).
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ GEM
addressable (~> 2.3)
mailchimp_api_v3 (0.2.18)
rest-client (~> 2)
mime-types (3.2.2)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
mime-types-data (3.2022.0105)
mini_mime (1.0.1)
mini_portile2 (2.8.1)
minitest (5.11.3)
Expand Down Expand Up @@ -243,7 +243,7 @@ GEM
thread_safe (0.3.6)
timers (4.3.0)
to_regexp (0.2.1)
tzinfo (1.2.5)
tzinfo (1.2.10)
thread_safe (~> 0.1)
uber (0.1.0)
unf (0.1.4)
Expand Down
2 changes: 1 addition & 1 deletion slack-api-explorer/api/presenters/status_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module StatusPresenter
property :ping

def ping
team = Team.asc(:_id).where(api: true).first
team = Team.active.asc(:_id).where(api: true).first
return unless team

team.ping!
Expand Down
14 changes: 12 additions & 2 deletions spec/api/endpoints/status_endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,24 @@
expect(status.teams_count).to eq 0
end

context 'with a team' do
let!(:team) { Fabricate(:team, active: false) }
context 'with an active team' do
let!(:team) { Fabricate(:team, active: true) }
it 'returns a status with ping' do
status = client.status
expect(status.teams_count).to eq 1
expect(status.active_teams_count).to eq 1
ping = status.ping
expect(ping['ok']).to eq 1
end
end

context 'with an inactive team' do
let!(:team) { Fabricate(:team, active: false) }
it 'returns no status' do
status = client.status
expect(status.active_teams_count).to eq 0
expect(status.teams_count).to eq 1
end
end
end
end

0 comments on commit d0d6a0f

Please sign in to comment.