lita-slack 1.2.0 → 1.3.0

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: d66ec3a2b33e9d4634eac3a5ea31ade4d9cd2cf8
4
- data.tar.gz: f01ab130866459571e789c46eceb842799e65c6e
3
+ metadata.gz: f3790328b5fe62b842097b9142959a8433dd59db
4
+ data.tar.gz: 49f7ab55e0f429f40019b164ffbd1e391a7d5008
5
5
  SHA512:
6
- metadata.gz: 44def16efc15e4f9fff1fa74ea41d1160763549ec0428e387e21866c7b59c61d6316757ed846f68415b8f51bcf037f2eced9206c8dfa0353cb9397a573af3bb1
7
- data.tar.gz: f41d6fbca14f735c0488116404f1acdc6afe97353ea9efa4bb5da47b299a9bbc0393bf2693600568f5348bd0702206d067622e464c847eed9776ac0aac97b2d6
6
+ metadata.gz: 61b7e539abbae3e559ab35bbac74bd1141db7485221141029ba30f9bf4e04abf91cccb1a7f0a3d867925ceb368f912ea6e981e5099a9f7d486fb81a97b09c9dc
7
+ data.tar.gz: 34b03cc4dedac3ab9e0a468f2b888d4fd88b76c9f309f0774c2b39499b172f5686c0b208a95d462f922f656ce70dcb6cec1b11757edd7ce6d3db5fd12779f73d
@@ -34,7 +34,15 @@ module Lita
34
34
  attr_reader :type
35
35
 
36
36
  def body
37
- data["text"].to_s.sub(/^\s*<@#{robot_id}>/, "@#{robot.mention_name}")
37
+ normalized_message = if data["text"]
38
+ data["text"].sub(/^\s*<@#{robot_id}>/, "@#{robot.mention_name}")
39
+ end
40
+
41
+ attachment_text = Array(data["attachments"]).map do |attachment|
42
+ attachment["text"]
43
+ end
44
+
45
+ ([normalized_message] + attachment_text).compact.join("\n")
38
46
  end
39
47
 
40
48
  def channel
data/lita-slack.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-slack"
3
- spec.version = "1.2.0"
3
+ spec.version = "1.3.0"
4
4
  spec.authors = ["Ken J.", "Jimmy Cuadra"]
5
5
  spec.email = ["kenjij@gmail.com", "jimmy@jimmycuadra.com"]
6
6
  spec.description = %q{Lita adapter for Slack.}
@@ -99,6 +99,28 @@ describe Lita::Adapters::Slack::MessageHandler, lita: true do
99
99
  end
100
100
  end
101
101
 
102
+ context "when the message has attach" do
103
+ let(:data) do
104
+ {
105
+ "type" => "message",
106
+ "channel" => "C2147483705",
107
+ "user" => "U023BECGF",
108
+ "text" => "Hello",
109
+ "attachments" => [{"text" => "attached hello"}]
110
+ }
111
+ end
112
+
113
+ it "recives attachment text" do
114
+ expect(Lita::Message).to receive(:new).with(
115
+ robot,
116
+ "Hello\nattached hello",
117
+ source
118
+ ).and_return(message)
119
+
120
+ subject.handle
121
+ end
122
+ end
123
+
102
124
  context "when the message is nil" do
103
125
  let(:data) do
104
126
  {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken J.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-19 00:00:00.000000000 Z
12
+ date: 2015-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine