Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit 54ac5b5

Browse files
committed
Only start OAuth v1 teams with a bot token.
1 parent 1b28455 commit 54ac5b5

File tree

11 files changed

+51
-8
lines changed

11 files changed

+51
-8
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
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 2020-11-14 17:59:41 -0500 using RuboCop version 0.81.0.
3+
# on 2020-11-25 13:42:05 -0500 using RuboCop version 0.81.0.
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

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
### Changelog
22

3-
#### 0.1.2 (Next)
3+
#### 0.2.0 (Next)
44

5+
* [#1](https://github.com/slack-ruby/slack-ruby-bot-server-rtm/pull/1): Only start OAuth v1 teams with a bot token - [@dblock](https://github.com/dblock).
56
* Your contribution here.
67

78
#### 0.1.1 (2020/11/15)

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ end
3838
group :test do
3939
gem 'slack-ruby-danger', '~> 0.2.0', require: false
4040
end
41+
42+
gem 'slack-ruby-bot-server', github: 'dblock/slack-ruby-bot-server', branch: 'oauth-version'

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@ Slack Ruby Bot Server RealTime (RTM) Extension
44
[![Gem Version](https://badge.fury.io/rb/slack-ruby-bot-server-rtm.svg)](https://badge.fury.io/rb/slack-ruby-bot-server-rtm)
55
[![Build Status](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-rtm.svg?branch=main)](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-rtm)
66

7-
An extension to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server) that makes it easy to implement Slack RTM bots.
7+
# Table of Contents
8+
9+
- [Introduction](#introduction)
10+
- [Samples](#samples)
11+
- [Usage](#usage)
12+
- [Gemfile](#gemfile)
13+
- [Configure](#configure)
14+
- [Server Class](#server-class)
15+
- [Copyright & License](#copyright--license)
16+
17+
### Introduction
18+
19+
This library is an extension to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server) that makes it easy to implement Slack RTM bots.
820

921
### Samples
1022

lib/slack-ruby-bot-server-rtm/lifecycle.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
end
66

77
SlackRubyBotServer::Config.service_class.instance.on :starting do |team, _error, options|
8+
next if team.respond_to?(:oauth_version) && team.oauth_version != 'v1'
9+
810
SlackRubyBotServer::Config.service_class.instance.logger.info "Starting real-time team #{team}."
911
options = { team: team }
1012
server = SlackRubyBotServer::RealTime::Config.server_class.new(options)

lib/slack-ruby-bot-server-rtm/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module SlackRubyBotServer
44
module RealTime
5-
VERSION = '0.1.2'
5+
VERSION = '0.2.0'
66
end
77
end

sample_apps/sample_app_activerecord/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gem 'otr-activerecord', '~> 1.2.1'
88
gem 'pg'
99
gem 'rack-server-pages'
1010
gem 'rack-test'
11+
gem 'slack-ruby-bot-server', github: 'dblock/slack-ruby-bot-server', branch: 'oauth-version'
1112
gem 'slack-ruby-bot-server-rtm', path: '../../'
1213
gem 'unicorn'
1314

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
class AddOauthFields < ActiveRecord::Migration[5.0]
4+
def change
5+
add_column :teams, :oauth_scope, :string
6+
add_column :teams, :oauth_version, :string, default: 'v1', null: false
7+
end
8+
end

sample_apps/sample_app_activerecord/db/schema.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#
1313
# It's strongly recommended that you check this file into your version control system.
1414

15-
ActiveRecord::Schema.define(version: 20_190_323_181_453) do
15+
ActiveRecord::Schema.define(version: 20_201_125_164_500) do
1616
# These are extensions that must be enabled in order to support this database
1717
enable_extension 'plpgsql'
1818

@@ -22,10 +22,12 @@
2222
t.boolean 'active', default: true
2323
t.string 'domain'
2424
t.string 'token'
25-
t.datetime 'created_at', null: false
26-
t.datetime 'updated_at', null: false
25+
t.datetime 'created_at', null: false
26+
t.datetime 'updated_at', null: false
2727
t.string 'bot_user_id'
2828
t.string 'activated_user_id'
2929
t.string 'activated_user_access_token'
30+
t.string 'oauth_scope'
31+
t.string 'oauth_version', default: 'v1', null: false
3032
end
3133
end

spec/database_adapters/activerecord/schema.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
t.string :bot_user_id
1414
t.string :activated_user_id
1515
t.string :activated_user_access_token
16+
t.string :oauth_scope
17+
t.string :oauth_version, default: 'v1', null: false
1618
t.boolean :active, default: true
1719
t.timestamps
1820
end

0 commit comments

Comments
 (0)