Skip to content

Commit

Permalink
Redirect to gamebot2.playplay.io.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Aug 28, 2024
1 parent 2a17dad commit 2e5715c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions public/js/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ $(document).ready(function() {
// Slack OAuth
var code = $.url('?code')
var game = $.url('?game')
var version = $.url('?version')
if (code && game && (game == 'pong' || game == 'chess' || game == 'pool' || game == 'tic-tac-toe')) {
PlayPlay.register();
PlayPlay.message('Working, please wait ...');
Expand All @@ -17,5 +18,8 @@ $(document).ready(function() {
},
error: PlayPlay.error
});
} else if (version != '1') {
// redirect to S'Up 2
window.location.href = "https://gamebot2.playplay.io";
}
});
24 changes: 18 additions & 6 deletions spec/integration/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@
describe 'index.html', :js, type: :feature do
let!(:game) { Fabricate(:game, name: 'pong') }

before do
visit '/'
context 'v1' do
before do
visit '/?version=1'
end

it 'includes a link to add to slack with the client id' do
expect(title).to eq('PlayPlay.io - Ping Pong Bot, Chess Bot, Pool Bot and Tic Tac Toe Bot for Slack')
click_link 'Add to Slack'
expect(first('a[class=add-to-slack]')['href']).to eq "https://slack.com/oauth/authorize?scope=bot&client_id=#{game.client_id}"
end
end

it 'includes a link to add to slack with the client id' do
expect(title).to eq('PlayPlay.io - Ping Pong Bot, Chess Bot, Pool Bot and Tic Tac Toe Bot for Slack')
click_link 'Add to Slack'
expect(first('a[class=add-to-slack]')['href']).to eq "https://slack.com/oauth/authorize?scope=bot&client_id=#{game.client_id}"
context 'v2' do
before do
visit '/'
end

it 'redirects' do
expect(current_url).to eq('https://gamebot2.playplay.io/')
end
end
end

0 comments on commit 2e5715c

Please sign in to comment.