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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 538195ef609b8545191a650afd2264a722de29fe
4
- data.tar.gz: 1dcc32d437547e690f6241beca18a5980ae20300
3
+ metadata.gz: 853bfa98b4792e8411a7163b75defa0517a06c7a
4
+ data.tar.gz: 64c81dfca6d3442fec0300d5e24535dd39f6439f
5
5
  SHA512:
6
- metadata.gz: d1e099f1a54bce4d2e24973fb05302bb00babc7a159ceb5fdef4686e0fbaae3d2539c860bd501b26607343e015e9557e40be03100a7301069eca22ad34b4aa34
7
- data.tar.gz: e2e83c9855f15e83ecbbb82afc48daac9b95fa4ce0372049b5f96ce450d41871aa7fe467f7b05c278c7af954068d5a9123c7cbdca8fb87b15db69ffd213e0735
6
+ metadata.gz: 4f98df72b876afa152652397618339ec417307decd6010b49e740b937bcfc2790f0ef8e42fd40ebb20ef0a258bca5a4826e8d0e0c875053c9dd31f9f54c17368
7
+ data.tar.gz: f0e316189d4f0df2ed8c6ac6df574556c43c1d1c490461a327c17a8bb7a1444b20168a79ebb82ee64bf0f2daad8b190392fd068d23e6393e827fe492c4e4f338
@@ -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
- response.reply('(failed) ' + t('label.owned',
150
- name: name,
151
- owner_name: o.name,
152
- owner_mention: o.mention_name))
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
- response.reply('(failed) ' + t('label.owned',
179
- name: name,
180
- owner_name: o.name,
181
- owner_mention: o.mention_name))
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-locker'
3
- spec.version = '0.5.1'
3
+ spec.version = '0.5.2'
4
4
  spec.authors = ['Eric Sigler']
5
5
  spec.email = ['me@esigler.com']
6
6
  spec.description = '"lock" and "unlock" arbitrary subjects'
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} %{owner_mention}"
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} %{owner_mention}"
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: '@alice')
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: '@bob')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-locker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Sigler