lita-locker 1.0.2 → 1.0.3

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: 05c37515e071dc49fb68a05ccefe0b708ef60bfd
4
- data.tar.gz: 4fe6d90d4764be77216f11625c8c377d4a6aaabb
3
+ metadata.gz: 51d68722a9a837146295120ccd13ec48d9135bbe
4
+ data.tar.gz: a821ec80a688f3b6ff13cae131d6fddb3c2233a5
5
5
  SHA512:
6
- metadata.gz: cb09f15584cd47ecbfbfbc6876fac0792d5708fd6e83012e4b7711578fe211770b9b1ba0ddcba4f62b252c00b421ad02bbf52dd1f25fc5a1d08f50b38136c128
7
- data.tar.gz: 534cc1c533df5b591bf9a6f3e0baf8644efb69a3763e0892d931439b9018aa63d6a6f38057b78fe771f17cd50f0c85b2bc74adad65f02452619bd3efb1f074cf
6
+ metadata.gz: 793ac5553e20c774572bc4f558c9badc5086b03689c5bcb8f5f48e2e5acc0d9633940a3f0bb1e3d509450fbfb47a93682477f20166e970b383e3c177b0acbef1
7
+ data.tar.gz: f7c7b6596d3b5d1a5b7eadedcdd9c0fad27cc929cfd4a650da06890cfb43227cf01b4d259542cc050466e95583c8955b0e79de14e790d6bce647db69a5ff427e
@@ -58,6 +58,11 @@ module Lita
58
58
  return response.reply(t('subject.does_not_exist', name: name)) unless Label.exists?(name)
59
59
  l = Label.new(name)
60
60
  l.wait_queue.delete(response.user.id)
61
+ queued = l.wait_queue.to_a
62
+ l.wait_queue.clear
63
+ queued.chunk { |x| x }.map(&:first).each do |user|
64
+ l.wait_queue << user
65
+ end
61
66
  response.reply(t('label.removed_from_queue', name: name))
62
67
  end
63
68
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-locker'
3
- spec.version = '1.0.2'
3
+ spec.version = '1.0.3'
4
4
  spec.authors = ['Eric Sigler']
5
5
  spec.email = ['me@esigler.com']
6
6
  spec.description = '"lock" and "unlock" arbitrary subjects'
@@ -69,6 +69,19 @@ describe Lita::Handlers::LockerMisc, lita_handler: true do
69
69
  send_command('locker dequeue foo', as: bob)
70
70
  expect(replies.last).to eq('You have been removed from the queue for foo')
71
71
  end
72
+
73
+ it 'avoids adjacent duplicates in the queue when a sandwiched dequeue occurs' do
74
+ send_command('locker resource create bar')
75
+ send_command('locker label create foo')
76
+ send_command('locker label add bar to foo')
77
+ send_command('lock foo', as: alice)
78
+ send_command('lock foo', as: bob)
79
+ send_command('lock foo', as: doris)
80
+ send_command('lock foo', as: bob)
81
+ send_command('locker dequeue foo', as: doris)
82
+ send_command('locker status foo')
83
+ expect(replies.last).to eq('foo is locked by Alice (taken 1 second ago). Next up: Bob')
84
+ end
72
85
  end
73
86
 
74
87
  describe '#status' 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: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Sigler