On Tuesday, September 4, 2018 at 9:39:53 AM UTC+2, Yves Pausch wrote:
>
> On Monday, September 3, 2018 at 11:00:22 PM UTC+2, Peter Suter wrote:
>>
>> On 03.09.2018 14:49, Yves Pausch wrote: 
>> > Hi, I added a custom field 'tester' and want this tester to be 
>> > notified in the way a CC is notified, when the ticket changes. Is 
>> > there a way to achieve this using trac 1.2 (+ plugin)? 
>> > Thanks, Yves. 
>>
>> Hi, 
>> Yes, try this: 
>> https://groups.google.com/d/msg/trac-users/xsE0h5VjfLA/F18nUAmKEAAJ 
>> I now also added this to: 
>>
>> https://trac.edgewall.org/wiki/CookBook/Notification/Subscriptions#Subscribeviacustomticketfield
>>  
>>
>> Hope this helps. 
>>
>
> Peter, yes, that helped a lot. Thank you very much. 
>
> Tiny change: I had to add a 'field_set = set()'
>
> Still an issue: The person mentioned in 'tester' is now notified as 
> expected when the ticket changes. But for the case we change the tester 
> value initially or later on, also the new value has to be informed. I 
> imagine adding the current value of 'tester' would do the job, but how to 
> access that value?
>
> Thanks for your help.
>

Yes, that's working. I changed  the section in matches() the following way:

# Harvest previous field values
field_set = set()
if 'fields' in event.changes and self.field_name in event.changes['fields']:
    
field_set.update(to_set(event.changes['fields'][self.field_name]['old'])) # 
collect the new tester(s)
    
field_set.update(to_set(event.changes['fields'][self.field_name]['new'])) # 
potentially also collect the new tester(s)

For other readers: To enable default subscription I had to add the 
following to trac.ini:

[notification-subscriber]
always_notify_tester = TesterCustomFieldSubscriber

Thanks again, Peter

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to