I’m looking at the steps to take to create a development copy of a busy Discourse site that can be used for training and testing by administrators but which won’t send any emails to non-administrators.
Am I correct in understanding that if all non-administrators are suspended then this would have the result I’m after?
And if this would work can anyone point me in the right direction for how to do this using the rails console?
Thanks, I don’t have a huge amount of experience of using the rails console so I’m afraid I didn’t get past that first line:
[1] pry(main)> UPDATE users
NameError: undefined local variable or method `users' for main:Object
Did you mean? user_mask
from (pry):1:in `__pry__'
Any suggestions?
For the criteria would it be something like this to only edit non-admins?
WHERE not(admin: true)
Yes, I have used the option to disable all outgoing emails in the past but the plan for this site is to have a test version of a site that can send out and receive emails but only admins can use it.
discourse=# SELECT FROM users WHERE admin='t';
--
(6 rows)
And then tried:
discourse=# UPDATE users
discourse-# SET silenced_till = '3019-02-01 13:00:00,'
discourse-# SET suspended_till = '3019-02-01 13:00:00'
discourse-# WHERE admin='f'
discourse-# RETURNING id, username_lower;
ERROR: syntax error at or near "SET"
LINE 3: SET suspended_till = '3019-02-01 13:00:00'
^
However this works:
discourse=# UPDATE users
discourse-# SET silenced_till = '3019-02-01 13:00:00', suspended_till = '3019-02-01 13:00:00'
discourse-# WHERE admin='f'
discourse-# RETURNING id, username_lower;