Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit ea2fb71

Browse files
committed
Merge pull request #492 from guyoron/trac
Allow trac.coffee to hear full ticket URLs
2 parents 1c108dc + e49255e commit ea2fb71

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/scripts/trac.coffee

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# Example: "Subversion,TeamCity,John Doe"
2323
# Commands:
2424
# #123 - Show details about a Trac ticket
25+
# Full ticket URL - Show details about a Trac ticket
2526
# r123 - Show details about a commit
2627
# [123] - Show details about a commit
2728
#
@@ -172,8 +173,8 @@ module.exports = (robot) ->
172173
msg.send "Trac r#{revision}: #{author} #{time} #{url}"
173174
msg.send line for line in message.split("\n")
174175

175-
# listen for ticket links
176-
robot.hear /([^\w]|^)\#(\d+)(?=[^\w]|$)/ig, (msg) ->
176+
# fetch ticket information using scraping or jsonrpc
177+
fetchTicket = (msg) ->
177178
if (ignoredusers.some (user) -> user == msg.message.user.name)
178179
console.log 'ignoring user due to blacklist:', msg.message.user.name
179180
return
@@ -192,6 +193,12 @@ module.exports = (robot) ->
192193
else
193194
msg.send "Trac \##{ticket}: #{process.env.HUBOT_TRAC_URL}/ticket/#{ticket}"
194195

196+
# listen for ticket numbers
197+
robot.hear /([^\w]|^)\#(\d+)(?=[^\w]|$)/ig, fetchTicket
198+
199+
# listen for ticket links
200+
ticketUrl = new RegExp("#{process.env.HUBOT_TRAC_URL}/ticket/([0-9]+)", 'ig')
201+
robot.hear ticketUrl, fetchTicket
195202

196203
# listen for changesets
197204
handleChangeset = (msg) ->

0 commit comments

Comments
 (0)