Setting defaults to enable mailing list mode-Temporary Solution

email

(Allen - Watchman Monitoring) #1

Continuing the discussion from Edit a user setting for all Discourse users:

So, I did this in my forum - I sent a nice email explaining what’s up, and just did it.

Then, I went ahead and set the defaults as I wanted to be checked by default - and have instructions telling people how they can change them if they want (all I did was set defaults, not lock them in place)

It’s been great. Discourse is now the mailing list I’ve wanted since day one, with the most functional web-ui out there.

Here’s how I did it, I sure hope I didn’t break anything horribly wrong, and am posting here to ensure that fact.

First, ssh in to your host as root.

cd /var/discourse/

./launcher ssh app

su postgres

psql

\c discourse
alter table only users alter column email_always set default true;
alter table only users alter column mailing_list_mode set default true;
\q

This error is expected: could not save history to file "/var/lib/postgresql/.psql_history": No such file or directory

exit  (to get out of the docker image)
exit  (to get out of the host)

Done.

At this point, I tell people that this is a mailing list, with the option to go web-only if they want.

Thank you discourse, for being awesome.


A way to force a user to get email notifications
Default email settings for a new user
Watching a Category, perhaps the best kind of mailing list mode?
Ability to set the default digest notification settings
Open links in new tab not working
Categories vs. Groups?
Make members of a group watch a category by default
Plugin suggestion - Set "watching" as default for a specific category on user signup
Should not receive emails for your own messages
(Jeff Atwood) #2

I don’t know how risky it is to change the default values in the DB. It doesn’t seem terribly dangerous to me, but I’m not sure.

Any comment on this @sam?


(Sam Saffron) #3

It should be fine, does not sound terribly risky but may eventually break if we refactor schema.


(Kane York) #4

Well, at that point, anything else that @watchmanmonitor could have possibly done would break too, so I think this is a good solution :slight_smile:


(Allen - Watchman Monitoring) #5

Ha ha ha ha ha. So true.

I’m just doing what i have to til this cow comes home:


(Iolo) #6

Is there a reason I wouldn’t include this in an exec custom command in app.yml?

- exec: sudo -u postgres psql -d discourse -c "alter table only users alter column email_private_messages set default false;"

(Allen - Watchman Monitoring) #7

There are two:

  • I didn’t know you could do that.
  • This is a one time, ever, action, so I wouldn’t want it to be done on every rebuild
    (or whatever docker process which might call that command)

(Jeff Atwood) #8

Well, you might, if the rebuild changed it back…


(Iolo) #9

That was my thinking, that and that automating it will make my life easier.


(Allen - Watchman Monitoring) #10

I wonder, as we move another database from self hosted to Discourse hosted, what is the best plan to ensure our users start out in Mailing list mode?


(Iolo) #11

The problem there is that the ability to do low level things like this is taken away when you move to external hosting. Internal and external hosting both come with pros and cons but to sum it up, its an inverse relationship between your ability to do things vs your potential to break things.


(Allen - Watchman Monitoring) #12

Right, I’m tired of the ability to break things, which is why I’mi bringing more of the discourse I manage to their hosting. In this case, I need this default set, and I believe that having a one-liner such as this in our app.yml would be compatible with discourse hosting.


(Channing Hinton) #13

This is absolutely beautiful. Thank you VERY much Allen.


(Allen - Watchman Monitoring) #14

For anyone following along… I’m leaning towards the use of auto-watched categories, as I feel the ability to unwatch any given topic puts more fine grained controls into the hands of the user.

This idea:

Combined with links in the footer:

would be really nice.

The links in the footer may have to be plugin material, as the last time I heard, at least @sam was not fond of putting lots of links in emails.


(John Oeffinger) #15

So the current manual way to set the person to watching is to impersonate the individual and set their category option to Watching, correct? You set this to the right on New Topic in the second nav bar at the top.


(Allen - Watchman Monitoring) #16

I suppose you could impersonate each new user, after you invite them, after they accept, and add category(ies) to their watch list for them, yes.

I know I need it added automatically, because I won’t be able to do it consistently.

I’m not sure I follow this comment… what did you have in mind about a New Topic?


(John Oeffinger) #17

I was just noting the location of where to set Watching, as opposed to somewhere in the Admin area.


(John Oeffinger) #18

I am asking if this is the correct way to do this now, or is there a global command. Since our site is a Discourse Hosted site, we can’t make the changes as you noted in the OP.


(Allen - Watchman Monitoring) #19

A global email defaults setup is a common request, you can add your vote here:


(Allen - Watchman Monitoring) #20

So, now it’s time to undo these defaults. because it’s in the admin now.

I wonder if there’s any way to compare the current running schema vs the discourse-supported one?