Sergey Tarasov
Sergey Tarasov

Reputation: 888

phabricator global email preferences

Is there a way to configure global email notification preferences in Phabricator?

I know that it allows to manage the preferences per user (https://secure.phabricator.com/book/phabricator/article/mail_rules/#reducing-email), but I'd like to configure default parameters to be inherited by all new user accounts.

Also it would be great if there is ability to update email notification preferences for existing user accounts in a bulk.

Upvotes: 3

Views: 1688

Answers (2)

Chad Little
Chad Little

Reputation: 873

As an admin, go to your Settings and click Global Settings. Change what you want. These will apply to all new accounts.

Upvotes: 6

Sergey Tarasov
Sergey Tarasov

Reputation: 888

To update email preferences for all users in a Phabricator instance:

1.run the following SQL script in mysql console:

use phabricator_user;

/*handle users who haven't customized their preferences yet (replace 'test' with name of your model user)*/
insert into user_preferences(userPHID, preferences) select l.PHID, (select p.preferences from  user u join user_preferences p on (p.userPHID=u.PHID) where   
u.userName = 'test') from user l where not exists(select * from user_preferences r where r.userPHID=l.PHID);

/*change individual parameters for all users*/
update user_preferences set preferences = replace(preferences, '"audit-add-ccs":1', '"audit-add-ccs":2');/*set A commit's subscribers change. to Ignore*/
update user_preferences set preferences = replace(preferences, '"audit-projects":1', '"audit-projects":2');
update user_preferences set preferences = replace(preferences, '"maniphest-priority":1', '"maniphest-priority":2');
update user_preferences set preferences = replace(preferences, '"maniphest-cc":1', '"maniphest-cc":2');
update user_preferences set preferences = replace(preferences, '"maniphest-projects":1', '"maniphest-projects":2');
update user_preferences set preferences = replace(preferences, '"maniphest-unblock":1', '"maniphest-unblock":2');
update user_preferences set preferences = replace(preferences, '"maniphest-column":1', '"maniphest-column":2');
update user_preferences set preferences = replace(preferences, '"maniphest-other":1', '"maniphest-other":2');

/*list current users' preferences*/
select u.phid, u.userName, p.preferences from user u left join user_preferences p on (p.userPhid=u.phid);

2.restart Phabricator daemons and the web server:

./bin/phd restart
service httpd restart

Disclaimer: it worked in my specific case on a specific revision of Phabricator, but it is certainly a "hack" and has a potential to damage user preferences.

Upvotes: 1

Related Questions