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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3790328b5fe62b842097b9142959a8433dd59db
|
4
|
+
data.tar.gz: 49f7ab55e0f429f40019b164ffbd1e391a7d5008
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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"]
|
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
@@ -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.
|
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-
|
12
|
+
date: 2015-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|