Any way to notify comment author when their comment is replied to?

66 views
Skip to first unread message

Dave Huang

unread,
Jan 11, 2016, 8:19:19 PM1/11/16
to trac-...@googlegroups.com
Hi there! In Trac 1.0.x, is there a way to send a notification to the author of a ticket comment when someone replies to their comment? They're not anyone who would normally get notifications from that ticket (not in Cc list, not reporter, not owner, etc...)--just some person who saw the ticket and commented on it. If someone replies to their comment, I'd like them to get an email notification of the reply.

None of the options in http://trac.edgewall.org/wiki/TracNotification seem to do this, and I didn't spot any tickets about this specifically (although perhaps http://trac.edgewall.org/ticket/11871 would work, in combination with replies defaulting to including an @mention)

RjOllos

unread,
Jan 26, 2016, 7:05:13 PM1/26/16
to Trac Users


On Monday, January 11, 2016 at 5:19:19 PM UTC-8, Dave Huang wrote:
Hi there! In Trac 1.0.x, is there a way to send a notification to the author of a ticket comment when someone replies to their comment? They're not anyone who would normally get notifications from that ticket (not in Cc list, not reporter, not owner, etc...)--just some person who saw the ticket and commented on it. If someone replies to their comment, I'd like them to get an email notification of the reply.

None of the options in http://trac.edgewall.org/wiki/TracNotification seem to do this, and I didn't spot any tickets about this specifically (although perhaps http://trac.edgewall.org/ticket/11871 would work, in combination with replies defaulting to including an @mention)

You could probably implement the feature in a plugin using the new notification API that is already implemented in Trac 1.1.6.

The challenging aspect will be to determine if the comment is a "replyto". That replyto information is stored in the cnum parameter.

The cnum (comment number) parameter doesn't appear to be directly available in the change listener, but the following might work:
* ticket['changetime'] should be equal to the timestamp of the change that triggered the change listener
* convert ticket['changetime'] to a cdate
* use the cdate to get the comment number via the Ticket.get_comment_number method: http://trac.edgewall.org/browser/tags/trac-1.1.6/trac/ticket/model.py#L294
* use the comment number to determine if the change was a reply-to comment
* if the change was a reply-to comment, use the comment number to lookup the author of the comment replied to, and send that author a notification

- Ryan

Olemis Lang

unread,
Jan 26, 2016, 7:53:06 PM1/26/16
to trac-...@googlegroups.com
[...]

Have you considered something like TracMentionsPlugin [1]_ ?

https://github.com/trac-hacks/trac-mentions


--
Regards,

Olemis - @olemislc

Apache™ Bloodhound contributor
http://issues.apache.org/bloodhound
http://blood-hound.net

Brython committer
http://brython.info
http://github.com/brython-dev/brython

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:

RjOllos

unread,
Mar 13, 2017, 8:02:00 PM3/13/17
to Trac Users, kh...@azeotrope.org


On Monday, January 11, 2016 at 5:19:19 PM UTC-8, Dave Huang wrote:
Hi there! In Trac 1.0.x, is there a way to send a notification to the author of a ticket comment when someone replies to their comment? They're not anyone who would normally get notifications from that ticket (not in Cc list, not reporter, not owner, etc...)--just some person who saw the ticket and commented on it. If someone replies to their comment, I'd like them to get an email notification of the reply.

None of the options in http://trac.edgewall.org/wiki/TracNotification seem to do this, and I didn't spot any tickets about this specifically (although perhaps http://trac.edgewall.org/ticket/11871 would work, in combination with replies defaulting to including an @mention)

Created #12728 (1) and will add a recipe to the CookBook (2) if no one else beats me to it.

- Ryan 

RjOllos

unread,
Mar 31, 2017, 11:49:27 PM3/31/17
to Trac Users, kh...@azeotrope.org

ReplyToTicketSubscriber has been added to the cookbook. See:
https://trac.edgewall.org/wiki/CookBook/Notification/Subscriptions

- Ryan

Dave Huang

unread,
Apr 27, 2017, 12:54:07 AM4/27/17
to RjOllos, Trac Users

On 3/31/2017 22:49, RjOllos wrote:
> ReplyToTicketSubscriber has been added to the cookbook. See:
> https://trac.edgewall.org/wiki/CookBook/Notification/Subscriptions
>
> - Ryan

Thanks, ReplyToTicketSubscriber works well! Is there a way to enable it
by default (e.g., in the notification-subscriber section of trac.ini)? I
tried adding "notify_replies = ReplyToTicketSubscriber" to the
notification-subscriber section, but it didn't show up in the Default
rules section of the Preferences Notifications tab.

I noticed that in the plugin's source, the default_subscriptions
function returned [], whereas the INotificationSubscribers that are in
the Trac core all do something like "return
NotificationSystem(self.env).default_subscriptions(klass)" (e.g.,
https://trac.edgewall.org/browser/branches/1.2-stable/trac/ticket/notification.py?rev=15714#L307).

I tried changing ReplyToTicketSubscriber's default_subscriptions to do
the same thing, which made it show up as a Default rule in the
Notifications Preferences, but I don't actually get any notifications
from it (whereas if I add it under Subscription rules, it works as
expected). I haven't tried looking into it further; I wanted to check
with the mailing list first to see if y'all had any suggestions :)

--
Name: Dave Huang | Mammal, mammal / their names are called /
INet: kh...@azeotrope.org | they raise a paw / the bat, the cat /
Telegram: @dahanc | dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 41 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++

Peter Suter

unread,
Apr 27, 2017, 2:09:35 AM4/27/17
to trac-...@googlegroups.com
On 27.04.2017 06:53, Dave Huang wrote:
> Thanks, ReplyToTicketSubscriber works well! Is there a way to enable it
> by default (e.g., in the notification-subscriber section of trac.ini)? I
> tried adding "notify_replies = ReplyToTicketSubscriber" to the
> notification-subscriber section, but it didn't show up in the Default
> rules section of the Preferences Notifications tab.
>
> I noticed that in the plugin's source, the default_subscriptions
> function returned [], whereas the INotificationSubscribers that are in
> the Trac core all do something like "return
> NotificationSystem(self.env).default_subscriptions(klass)" (e.g.,
> https://trac.edgewall.org/browser/branches/1.2-stable/trac/ticket/notification.py?rev=15714#L307).
>
>
> I tried changing ReplyToTicketSubscriber's default_subscriptions to do
> the same thing, which made it show up as a Default rule in the
> Notifications Preferences, but I don't actually get any notifications
> from it (whereas if I add it under Subscription rules, it works as
> expected). I haven't tried looking into it further; I wanted to check
> with the mailing list first to see if y'all had any suggestions :)
>

You're probably on the right track, but also need one more thing:
Add back the "default_subscriptions()" handling in "matches()".
I removed that part[1] because the part you now added was still missing.
(Please add them both to the wiki page after confirming that it works.)

[1] The first chunk in
https://trac.edgewall.org/wiki/CookBook/Notification/Subscriptions?action=diff&version=11&old_version=10


Peter

RjOllos

unread,
Feb 20, 2019, 4:04:42 PM2/20/19
to Trac Users
Reply all
Reply to author
Forward
0 new messages