\r
private static final String LOCALE = "locale";\r
\r
+ private static final String EMAILONMYTICKETCHANGES = "emailMeOnMyTicketChanges";\r
+\r
private static final String ACCOUNTTYPE = "accountType";\r
\r
private static final String DISABLED = "disabled";\r
String val = model.getPreferences().getLocale().getLanguage() + "_" + model.getPreferences().getLocale().getCountry();\r
config.setString(USER, model.username, LOCALE, val);\r
}\r
+ config.setBoolean(USER, model.username, EMAILONMYTICKETCHANGES, model.getPreferences().isEmailMeOnMyTicketChanges());\r
}\r
\r
// user roles\r
\r
// preferences\r
user.getPreferences().setLocale(config.getString(USER, username, LOCALE));\r
+ user.getPreferences().setEmailMeOnMyTicketChanges(config.getBoolean(USER, username, EMAILONMYTICKETCHANGES, true));\r
\r
// user roles\r
Set<String> roles = new HashSet<String>(Arrays.asList(config.getStringList(\r
private String locale;
+ private Boolean emailMeOnMyTicketChanges;
+
private final Map<String, UserRepositoryPreferences> repositoryPreferences = new TreeMap<String, UserRepositoryPreferences>();
public UserPreferences(String username) {
Collections.sort(list);
return list;
}
+
+ public boolean isEmailMeOnMyTicketChanges() {
+ if (emailMeOnMyTicketChanges == null) {
+ return true;
+ }
+ return emailMeOnMyTicketChanges;
+ }
+
+ public void setEmailMeOnMyTicketChanges(boolean value) {
+ this.emailMeOnMyTicketChanges = value;
+ }
}
}
}
}
- mailing.setRecipients(toAddresses);
//
// CC recipients
// repository owners
if (!ArrayUtils.isEmpty(repository.owners)) {
- tos.addAll(repository.owners);
+ ccs.addAll(repository.owners);
}
// cc users mentioned in last comment
}
ccAddresses.addAll(settings.getStrings(Keys.mail.mailingLists));
+ // respect the author's email preference
+ UserModel lastAuthor = userManager.getUserModel(lastChange.author);
+ if (!lastAuthor.getPreferences().isEmailMeOnMyTicketChanges()) {
+ toAddresses.remove(lastAuthor.emailAddress);
+ ccAddresses.remove(lastAuthor.emailAddress);
+ }
+
+ mailing.setRecipients(toAddresses);
mailing.setCCs(ccAddresses);
}
gb.accountPreferencesDescription = Specify your account preferences
gb.languagePreference = Language Preference
gb.languagePreferenceDescription = Select your preferred translation for Gitblit
+gb.emailMeOnMyTicketChanges = Email me on my ticket changes
+gb.emailMeOnMyTicketChangesDescription = Send me an email notification for changes that I make to a ticket
gb.displayNameDescription = The preferred name for display
gb.emailAddressDescription = The primary email address for receiving notifications
gb.sshKeys = SSH Keys
<form wicket:id="prefsForm">\r
<div wicket:id="displayName"></div>\r
<div wicket:id="emailAddress"></div>\r
- <div wicket:id="language"></div> \r
+ <div wicket:id="language"></div>\r
+ <div wicket:id="emailMeOnMyTicketChanges"></div>\r
\r
<div class="form-actions"><input class="btn btn-appmenu" type="submit" value="Save" wicket:message="value:gb.save" wicket:id="save" /></div>\r
</form> \r
import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.GitblitRedirectException;\r
import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.panels.BooleanOption;\r
import com.gitblit.wicket.panels.ChoiceOption;\r
import com.gitblit.wicket.panels.ProjectRepositoryPanel;\r
import com.gitblit.wicket.panels.SshKeysPanel;\r
final IModel<String> displayName = Model.of(user.getDisplayName());\r
final IModel<String> emailAddress = Model.of(user.emailAddress == null ? "" : user.emailAddress);\r
final IModel<Language> language = Model.of(preferredLanguage);\r
+ final IModel<Boolean> emailMeOnMyTicketChanges = Model.of(user.getPreferences().isEmailMeOnMyTicketChanges());\r
\r
prefs.add(new TextOption("displayName",\r
getString("gb.displayName"),\r
language,\r
languages));\r
\r
+ prefs.add(new BooleanOption("emailMeOnMyTicketChanges",\r
+ getString("gb.emailMeOnMyTicketChanges"),\r
+ getString("gb.emailMeOnMyTicketChangesDescription"),\r
+ emailMeOnMyTicketChanges).setVisible(app().notifier().isSendingMail()));\r
+\r
prefs.add(new AjaxButton("save") {\r
\r
private static final long serialVersionUID = 1L;\r
user.getPreferences().setLocale(lang.code);\r
}\r
\r
+ user.getPreferences().setEmailMeOnMyTicketChanges(emailMeOnMyTicketChanges.getObject());\r
+\r
try {\r
app().gitblit().reviseUser(user.username, user);\r
\r