ruboty-redmine 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruboty/handlers/redmine.rb +27 -4
- data/lib/ruboty/redmine/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 759100cbf0b5752c77f02070110eaf87240727f0
|
4
|
+
data.tar.gz: e486952501594a90cc2336d14ec24b5985c73c02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0782d74534eb79f1b85031ae08c9dce588564bb50673784d45028c2137dd612b6cd71a8fdf9d7c254b74d0d7de50e37a475941c7d0897fbac251eb2bc43171a
|
7
|
+
data.tar.gz: 096427b5f830ba198df16fddb8d63ee90c5a4a8cd3be207be6d3a9247fe9d926e63bd22ba0797fd3a27cacab70d5d23fcde4ecd615d72fe86e32c50550ea90be
|
@@ -40,13 +40,13 @@ module Ruboty
|
|
40
40
|
)
|
41
41
|
|
42
42
|
on(
|
43
|
-
/redmine stop assigning to (?<
|
43
|
+
/redmine stop assigning to (?<user>.+)/,
|
44
44
|
name: 'stop_assigning',
|
45
45
|
description: 'Stop assigning issues to the user',
|
46
46
|
)
|
47
47
|
|
48
48
|
on(
|
49
|
-
/redmine start assigning to (?<
|
49
|
+
/redmine start assigning to (?<user>.+)/,
|
50
50
|
name: 'start_assigning',
|
51
51
|
description: 'Start assigning issues to the user',
|
52
52
|
)
|
@@ -157,13 +157,23 @@ module Ruboty
|
|
157
157
|
end
|
158
158
|
|
159
159
|
def stop_assigning(message)
|
160
|
-
u = message[:
|
160
|
+
u = username_to_redmine_id(message[:user])
|
161
|
+
unless u
|
162
|
+
message.reply("#{message[:user]} is not found")
|
163
|
+
return
|
164
|
+
end
|
165
|
+
|
161
166
|
absent_users << u.to_i
|
162
167
|
message.reply("Stop assigning issues to #{u}")
|
163
168
|
end
|
164
169
|
|
165
170
|
def start_assigning(message)
|
166
|
-
u = message[:
|
171
|
+
u = username_to_redmine_id(message[:user])
|
172
|
+
unless u
|
173
|
+
message.reply("#{message[:user]} is not found")
|
174
|
+
return
|
175
|
+
end
|
176
|
+
|
167
177
|
absent_users.delete(u.to_i)
|
168
178
|
message.reply("Start assigning issues to #{u}")
|
169
179
|
end
|
@@ -174,6 +184,19 @@ module Ruboty
|
|
174
184
|
|
175
185
|
private
|
176
186
|
|
187
|
+
def username_to_redmine_id(username)
|
188
|
+
case username
|
189
|
+
when /\A\d+\z/
|
190
|
+
username.to_i # redmine_id
|
191
|
+
else
|
192
|
+
u = users.find do |u|
|
193
|
+
u['chat_name'] == username
|
194
|
+
end
|
195
|
+
|
196
|
+
u && u['redmine_id']
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
177
200
|
def redmine
|
178
201
|
@redmine ||= Ruboty::Redmine::Client.new(
|
179
202
|
ENV['REDMINE_URL'],
|