lita-ticket_notifier 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36e52f4c9a8723044f660371ed54dc1440f0b54e
4
- data.tar.gz: 6c3e6757f9610ddf09fea04bff0fb7ab7a432bab
3
+ metadata.gz: 07ea5e3f9e0d1f5ded04baf1b61b9c5e95758dd6
4
+ data.tar.gz: 7d286988170deac84b84b5bf28f44c0efc8b0e0d
5
5
  SHA512:
6
- metadata.gz: 0496fc3b78aeca3868522e1d9d298009a32893ec7747d590c2ee2ed2b66eb1719b8711a802d497e7aab93bd3f43789898d6fb5b2c9bcb8337f44532356fa783a
7
- data.tar.gz: 75715e06f09895afb54187185c3efed1a3e9ee248b2c89ffe8c162a0c08d2745aff8f65da8174ca93c10f1910d077e95f6108a7c1990e80aedcf97766c170488
6
+ metadata.gz: 8866bb90007f009360654c90ac4b4355956428ff41dcacff5934e24ff9ee8b42199dde6d308e6208749f3a7369cabec8a4f7d01e4d32243fee28a7d7f90f4c24
7
+ data.tar.gz: 2f22fbe3bba62260695bcd7cd0711e50981e6f11b29acefd3ba154632ad2ca526058b3e18858409335e9cfbdf63fee54d6bac230ce458a6ede0ac829c34222c0
@@ -20,11 +20,15 @@ module Lita
20
20
  end
21
21
 
22
22
  def add_ticket_notification(response)
23
+ response.reply_privately "You're already on the list." and return if user_names.include? response.user.name
24
+
23
25
  redis.lpush("ticket_users", response.user.name)
24
26
  response.reply_privately "You will now get notified of ticket updates."
25
27
  end
26
28
 
27
29
  def remove_ticket_notification(response)
30
+ response.reply_privately "You weren't on the list." and return unless user_names.include? response.user.name
31
+
28
32
  redis.lrem("ticket_users", 0, response.user.name)
29
33
  response.reply_privately "You will no longer receive ticket update notifications."
30
34
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-ticket_notifier"
3
- spec.version = "0.0.15"
3
+ spec.version = "0.0.16"
4
4
  spec.authors = ["Michael van den Beuken", "Ruben Estevez", "Jordan Babe", "Mathieu Gilbert", "Ryan Jones", "Darko Dosenovic"]
5
5
  spec.email = ["michael.beuken@gmail.com", "ruben.a.estevez@gmail.com", "jorbabe@gmail.com", "mathieu.gilbert@ama.ab.ca", "ryan.michael.jones@gmail.com", "darko.dosenovic@ama.ab.ca"]
6
6
  spec.description = %q{Notify users about new tickets coming in.}
@@ -25,6 +25,26 @@ describe Lita::Handlers::TicketNotifier, lita_handler: true do
25
25
  subject.ticket_notification(request, nil)
26
26
  end
27
27
 
28
+ it "doesn't add you twice" do
29
+ send_command("ticket notify start")
30
+ send_command("ticket notify start")
31
+
32
+ expect(replies.count).to eq(2)
33
+ expect(replies.first).to eq("You will now get notified of ticket updates.")
34
+ expect(replies.last).to eq("You're already on the list.")
35
+
36
+ expect(subject).to receive(:send_message_to_user).once
37
+
38
+ subject.ticket_notification(request, nil)
39
+ end
40
+
41
+ it "lets you know you're already not getting notifications" do
42
+ send_command("ticket notify stop")
43
+
44
+ expect(replies.count).to eq(1)
45
+ expect(replies.first).to eq("You weren't on the list.")
46
+ end
47
+
28
48
  it "doesn't send notifications to nobody" do
29
49
  expect(subject).to_not receive(:send_message_to_user)
30
50
  subject.ticket_notification(request, nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-ticket_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van den Beuken