Opened 4 years ago

Closed 4 years ago

# Ability to specify defaults for Ticket Notifications options

Reported by: Owned by: rjollos doki_pen normal AnnouncerPlugin normal 0.11

### Description

Under my installation, the following options are always unselected as the default:

• Notify me of changes to tickets that belong to components that I own.
• Notify me of changes to tickets that I own.
• Notify me of changes to tickets that I reported.
• Never notify me of my own changes to tickets.

It would be nice to have the option to specify those options as selected (true) by default.

### comment:1 Changed 4 years ago by rjollos

Here is an image of what I was referring to:

### comment:2 Changed 4 years ago by jevans

Ideally reflect the current condition (i.e. defaults) when user hasn't saved preferences using the always_notify_* settings in the ini.

### comment:3 Changed 4 years ago by rjollos

My thought was to have a number of default options in the announcer section:

[announcer]
default_notify_changes_owner = {true/false}
default_notify_changes_reporter = {true/false}
default_notify_changes_component_owner = {true/false}
default_notify_changes_self = {true/false}


For the screen capture I showed, assuming the selections reflect the defaults, I would have:

[announcer]
default_notify_changes_owner = true
default_notify_changes_reporter = true
default_notify_changes_component_owner = true
default_notify_changes_self = false


The defaults could used when the user has not specified otherwise in preferences.

### comment:4 follow-up: ↓ 5 Changed 4 years ago by jevans

If I understand correctly, with the LegacyTicketSubscriber enabled, the always_notify_* settings control behavior until a user makes his own choices. Makes sense to me to have the check boxes reflect those settings the first time the user displays them.

### comment:5 in reply to: ↑ 4 Changed 4 years ago by rjollos

If I understand correctly, with the LegacyTicketSubscriber enabled, the always_notify_* settings control behavior until a user makes his own choices. Makes sense to me to have the check boxes reflect those settings the first time the user displays them.

That would make sense based on some of the behavior I have seen. But yes, the check boxes are definitely 'out of sync', initially. So perhaps this is an easier fix than I had thought?

### comment:6 Changed 4 years ago by doki_pen

• Status changed from new to assigned

This used to work :( I wonder how I fudged it up. Looking into it.

### comment:7 Changed 4 years ago by doki_pen

Ok, after looking at the code I realize why this is difficult.
There are actually three states (on off and default). So when a user saves their preferences, how do we know if they want to stick with the default, or explicitly set it the same as the default? But I agree that it should match the defaults on the first view.

### comment:8 Changed 4 years ago by rjollos

You might take a look at how the code is implemented for the Pygments theme preference http://trac.edgewall.org/prefs/pygments in Trac. It seems to exhibit the ideal behavior with regard to handling a user preference and a default value for that preference.

For example, I recently changed the trac.ini parameter default_syntax_coloring, which determines the default value for the Theme. What I found was that, for an account where I had previously accessed the Pygments theme preference and set a syntax coloring preference, this setting was preserved. However, for an account were I had not set this preference, the specified default value was set (it was set to Colorful, whereas when default_syntax_coloring is unspecified, the default is Trac).

### comment:10 Changed 4 years ago by doki_pen

The complication is that the entire announcer preferences panel is sent and we don't know which was the one the user actually choose. I still think the best we can do is as described above though.

### comment:11 Changed 4 years ago by doki_pen

Alright, I looked some more and this is how it works:

If the setting is set to false globally then the user can not set it to true for himself. The user can only opt-out of global settings. I think this doesn't make much sense. I don't see why the admin would want to disallow ppl from subscribing to events like component, author, owner etc.. Therefore I'm going to change the behavior in trunk.

The global settings in trac.ini will act as the default settings (as we expected it to work). Users will be able to override any of them with their won setting.

### comment:12 Changed 4 years ago by doki_pen

• Resolution set to fixed
• Status changed from assigned to closed

(In [7147]) User ticket notification settings display defaults on first display
fixes #5572

### comment:13 Changed 4 years ago by dbely

• Resolution fixed deleted
• Status changed from closed to reopened

r7141 is incorrect. You are checking announcer_legacy_notify_component_owner, announcer_legacy_notify_owner, announcer_legacy_notify_reporter, announcer_legacy_notify_updater for "True" value while they are set to "true"|"false" (note the register difference). Due to that they are always shown disabled in preferences. The patch fixing that is attached.

### comment:14 Changed 4 years ago by doki_pen

• Resolution set to fixed
• Status changed from reopened to closed

(In [7575]) User ticket notification settings display defaults on first display

fixes #5572
merge -r7147

### Modify Ticket

Change Properties