lita-jira 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/lita/handlers/jira.rb +9 -3
- data/lita-jira.gemspec +1 -1
- data/spec/lita/handlers/jira_spec.rb +17 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eca25015401127d628654b155f01c2186adee367
|
4
|
+
data.tar.gz: 8ecded11919390a55da963235b9b7eeb9f272382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f736bd91ff2ff195ec600a289f44b1d58397b6eb874643597b4f6fd024c6e6c3fb053eccdc0175f0952354e2ae809ffe63f3a50923bbe9299f3e017daba4de69
|
7
|
+
data.tar.gz: dd89520f0235451055bd7243b011aabf3d65ec6a0334b1937e9139032ff9a5bf14956fd69f38ba137daa734f4ee67e5ae0edab4523ff02b703c1750a626bea83
|
data/README.md
CHANGED
@@ -31,14 +31,14 @@ config.handlers.jira.site = 'https://your.jira.instance.example.com/'
|
|
31
31
|
* `context` (string) - If your instance is in a /subdirectory, put that here. Default: `''`
|
32
32
|
* `format` (string) - You can select a compact one line issue summary by setting this parameter to `one-line`. Default: `verbose`
|
33
33
|
* `ambient` (boolean) - When set to `true`, Lita will show JIRA issue details when a JIRA issue key is mentioned in chat, outside the context of a command. Default: `false`
|
34
|
-
* `ignore` (array) - Prevent ambient JIRA issue detection in certain users' messages. Default: `[]`
|
34
|
+
* `ignore` (array) - Prevent ambient JIRA issue detection in certain users' messages. Accepts user names, mention names, and IDs. Default: `[]`
|
35
35
|
* `rooms` (array) - Limit ambient JIRA issue detection to a certain list of rooms. If unspecified, the bot will respond to detected issues in all rooms.
|
36
36
|
|
37
37
|
``` ruby
|
38
38
|
config.handlers.jira.context = '/myjira'
|
39
|
-
config.handlers.jira.ambient = true
|
40
39
|
config.handlers.jira.format = 'one-line'
|
41
|
-
config.handlers.jira.
|
40
|
+
config.handlers.jira.ambient = true
|
41
|
+
config.handlers.jira.ignore = ['Jira', 'Github', 'U1234']
|
42
42
|
config.handlers.jira.rooms = ['devtools', 'engineering']
|
43
43
|
```
|
44
44
|
|
data/lib/lita/handlers/jira.rb
CHANGED
@@ -3,6 +3,7 @@ module Lita
|
|
3
3
|
# Because we can.
|
4
4
|
module Handlers
|
5
5
|
# Main handler
|
6
|
+
# rubocop:disable Metrics/ClassLength
|
6
7
|
class Jira < Handler
|
7
8
|
namespace 'Jira'
|
8
9
|
|
@@ -114,18 +115,23 @@ module Lita
|
|
114
115
|
end
|
115
116
|
|
116
117
|
def ambient(response)
|
117
|
-
return if invalid_ambient(response)
|
118
|
+
return if invalid_ambient?(response)
|
118
119
|
issue = fetch_issue(response.match_data['issue'], false)
|
119
120
|
response.reply(format_issue(issue)) if issue
|
120
121
|
end
|
121
122
|
|
122
123
|
private
|
123
124
|
|
124
|
-
def invalid_ambient(response)
|
125
|
-
response.message.command? || !config.ambient ||
|
125
|
+
def invalid_ambient?(response)
|
126
|
+
response.message.command? || !config.ambient || ignored?(response.user) || (config.rooms && !config.rooms.include?(response.message.source.room))
|
127
|
+
end
|
128
|
+
|
129
|
+
def ignored?(user)
|
130
|
+
config.ignore.include?(user.id) || config.ignore.include?(user.mention_name) || config.ignore.include?(user.name)
|
126
131
|
end
|
127
132
|
# rubocop:enable Metrics/AbcSize
|
128
133
|
end
|
134
|
+
# rubocop:enable Metrics/ClassLength
|
129
135
|
Lita.register_handler(Jira)
|
130
136
|
end
|
131
137
|
end
|
data/lita-jira.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-jira'
|
3
|
-
spec.version = '0.7.
|
3
|
+
spec.version = '0.7.1'
|
4
4
|
spec.authors = ['Eric Sigler', 'Matt Critchlow']
|
5
5
|
spec.email = ['me@esigler.com', 'matt.critchlow@gmail.com']
|
6
6
|
spec.description = 'A JIRA plugin for Lita.'
|
@@ -201,9 +201,11 @@ describe Lita::Handlers::Jira, lita_handler: true do
|
|
201
201
|
|
202
202
|
context 'and an ignore list is defined' do
|
203
203
|
before(:each) do
|
204
|
-
@user1 = Lita::User.create(
|
205
|
-
@user2 = Lita::User.create(
|
206
|
-
|
204
|
+
@user1 = Lita::User.create('U1', name: 'User 1', mention_name: 'user1')
|
205
|
+
@user2 = Lita::User.create('U2', name: 'User 2', mention_name: 'user2')
|
206
|
+
@user3 = Lita::User.create('U3', name: 'User 3', mention_name: 'user3')
|
207
|
+
@user4 = Lita::User.create('U4', name: 'User 4', mention_name: 'user4')
|
208
|
+
registry.config.handlers.jira.ignore = ['User 2', 'U3', 'user4']
|
207
209
|
end
|
208
210
|
|
209
211
|
it 'shows details for a detected issue sent by a user absent from the list' do
|
@@ -211,10 +213,20 @@ describe Lita::Handlers::Jira, lita_handler: true do
|
|
211
213
|
expect(replies.last).to eq("[XYZ-987] Some summary text\nStatus: In Progress, assigned to: A Person, fixVersion: Sprint 2, priority: P0\nhttp://jira.local/browse/XYZ-987")
|
212
214
|
end
|
213
215
|
|
214
|
-
it 'does not show details for a detected issue sent by a user on the list' do
|
216
|
+
it 'does not show details for a detected issue sent by a user whose name is on the list' do
|
215
217
|
send_message('foo XYZ-987 bar', as: @user2)
|
216
218
|
expect(replies.size).to eq(0)
|
217
219
|
end
|
220
|
+
|
221
|
+
it 'does not show details for a detected issue sent by a user whose ID is on the list' do
|
222
|
+
send_message('foo XYZ-987 bar', as: @user3)
|
223
|
+
expect(replies.size).to eq(0)
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'does not show details for a detected issue sent by a user whose mention name is on the list' do
|
227
|
+
send_message('foo XYZ-987 bar', as: @user4)
|
228
|
+
expect(replies.size).to eq(0)
|
229
|
+
end
|
218
230
|
end
|
219
231
|
|
220
232
|
context 'and a room list is defined' do
|
@@ -262,7 +274,7 @@ describe Lita::Handlers::Jira, lita_handler: true do
|
|
262
274
|
it 'shows results when returned' do
|
263
275
|
grab_request(valid_client)
|
264
276
|
send_command('jira myissues')
|
265
|
-
expect(replies
|
277
|
+
expect(replies[-3..-1]).to eq([
|
266
278
|
'Here are issues currently assigned to you:',
|
267
279
|
"[XYZ-987] Some summary text\nStatus: In Progress, assigned to: A Person, fixVersion: Sprint 2, priority: P0\nhttp://jira.local/browse/XYZ-987",
|
268
280
|
"[XYZ-988] Some summary text 2\nStatus: In Progress 2, assigned to: A Person 2, fixVersion: none, priority: P1\nhttp://jira.local/browse/XYZ-988"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-jira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Sigler
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: lita
|