lita-locker 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/locker.rb +20 -8
- data/lita-locker.gemspec +1 -1
- data/locales/en.yml +4 -2
- data/spec/lita/handlers/locker_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 853bfa98b4792e8411a7163b75defa0517a06c7a
|
4
|
+
data.tar.gz: 64c81dfca6d3442fec0300d5e24535dd39f6439f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f98df72b876afa152652397618339ec417307decd6010b49e740b937bcfc2790f0ef8e42fd40ebb20ef0a258bca5a4826e8d0e0c875053c9dd31f9f54c17368
|
7
|
+
data.tar.gz: f0e316189d4f0df2ed8c6ac6df574556c43c1d1c490461a327c17a8bb7a1444b20168a79ebb82ee64bf0f2daad8b190392fd068d23e6393e827fe492c4e4f338
|
data/lib/lita/handlers/locker.rb
CHANGED
@@ -146,10 +146,16 @@ module Lita
|
|
146
146
|
l = label(name)
|
147
147
|
if l['state'] == 'locked'
|
148
148
|
o = Lita::User.find_by_id(l['owner_id'])
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
149
|
+
if o.mention_name
|
150
|
+
response.reply('(failed) ' + t('label.owned_mention',
|
151
|
+
name: name,
|
152
|
+
owner_name: o.name,
|
153
|
+
owner_mention: o.mention_name))
|
154
|
+
else
|
155
|
+
response.reply('(failed) ' + t('label.owned',
|
156
|
+
name: name,
|
157
|
+
owner_name: o.name))
|
158
|
+
end
|
153
159
|
else
|
154
160
|
response.reply('(failed) ' + t('label.dependency'))
|
155
161
|
end
|
@@ -175,10 +181,16 @@ module Lita
|
|
175
181
|
response.reply('(successful) ' + t('label.unlock', name: name))
|
176
182
|
else
|
177
183
|
o = Lita::User.find_by_id(l['owner_id'])
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
184
|
+
if o.mention_name
|
185
|
+
response.reply('(failed) ' + t('label.owned_mention',
|
186
|
+
name: name,
|
187
|
+
owner_name: o.name,
|
188
|
+
owner_mention: o.mention_name))
|
189
|
+
else
|
190
|
+
response.reply('(failed) ' + t('label.owned',
|
191
|
+
name: name,
|
192
|
+
owner_name: o.name))
|
193
|
+
end
|
182
194
|
end
|
183
195
|
end
|
184
196
|
else
|
data/lita-locker.gemspec
CHANGED
data/locales/en.yml
CHANGED
@@ -57,12 +57,14 @@ en:
|
|
57
57
|
is_locked: "%{name} is locked"
|
58
58
|
unlock: "%{name} unlocked"
|
59
59
|
is_unlocked: "%{name} is unlocked"
|
60
|
-
owned: "%{name} is locked by %{owner_name}
|
60
|
+
owned: "%{name} is locked by %{owner_name}"
|
61
|
+
owned_mention: "%{name} is locked by %{owner_name} (@%{owner_mention})"
|
61
62
|
subject:
|
62
63
|
does_not_exist: "Sorry, that does not exist"
|
63
64
|
label:
|
64
65
|
unlock: "%{name} unlocked"
|
65
|
-
owned: "%{name} is locked by %{owner_name}
|
66
|
+
owned: "%{name} is locked by %{owner_name}"
|
67
|
+
owned_mention: "%{name} is locked by %{owner_name} (@%{owner_mention})"
|
66
68
|
is_unlocked: "%{name} is unlocked"
|
67
69
|
unable_to_lock: "%{name} unable to be locked"
|
68
70
|
lock: "%{name} locked"
|
@@ -58,11 +58,11 @@ describe Lita::Handlers::Locker, lita_handler: true do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
let(:alice) do
|
61
|
-
Lita::User.create('9001@hipchat', name: 'Alice', mention_name: '
|
61
|
+
Lita::User.create('9001@hipchat', name: 'Alice', mention_name: 'alice')
|
62
62
|
end
|
63
63
|
|
64
64
|
let(:bob) do
|
65
|
-
Lita::User.create('9002@hipchat', name: 'Bob', mention_name: '
|
65
|
+
Lita::User.create('9002@hipchat', name: 'Bob', mention_name: 'bob')
|
66
66
|
end
|
67
67
|
|
68
68
|
describe '#lock' do
|
@@ -101,7 +101,7 @@ describe Lita::Handlers::Locker, lita_handler: true do
|
|
101
101
|
send_command('locker label add foobar to bazbat')
|
102
102
|
send_command('lock bazbat', as: alice)
|
103
103
|
send_command('lock bazbat', as: bob)
|
104
|
-
expect(replies.last).to eq('(failed) bazbat is locked by Alice @alice')
|
104
|
+
expect(replies.last).to eq('(failed) bazbat is locked by Alice (@alice)')
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'shows an error when a label does not exist' do
|
@@ -141,7 +141,7 @@ describe Lita::Handlers::Locker, lita_handler: true do
|
|
141
141
|
send_command('locker label add foobar to bazbat')
|
142
142
|
send_command('lock bazbat', as: alice)
|
143
143
|
send_command('unlock bazbat', as: bob)
|
144
|
-
expect(replies.last).to eq('(failed) bazbat is locked by Alice @alice')
|
144
|
+
expect(replies.last).to eq('(failed) bazbat is locked by Alice (@alice)')
|
145
145
|
end
|
146
146
|
|
147
147
|
it 'shows a warning when a label is already unlocked' do
|