fefrei
(Felix Freiberger)
17. Juni 2016 um 16:57
1
I’m using incoming mail support for group messaging with staged users.
This works fine if the address the message is coming from is new. However, I am re-purposing a Discourse installation for a yearly event , and some old users are stuck with an inactive accounts they can no longer log in to.
When such a user sends a mail to Discourse, they are rejected with Email::Receiver::InactiveUserError
.
What’s the best method to prevent this issue? Would replacing the mail address of the inactive accounts work?
1 „Gefällt mir“
Any thoughts here @zogstrip ?
1 „Gefällt mir“
zogstrip
(Régis Hanol)
20. Juni 2016 um 15:16
3
The InactiveUserError
happens only when the user is not activated and not staged. If you want your users to be able to send emails in, you will have to either activate their account or mark them as staged.
2 „Gefällt mir“
fefrei
(Felix Freiberger)
20. Juni 2016 um 18:56
4
Can I mark existing, inactive users as staged? Would that have any side effects?
zogstrip
(Régis Hanol)
20. Juni 2016 um 19:37
5
Other than enabling them to send emails in, none
1 „Gefällt mir“
fefrei
(Felix Freiberger)
21. Juni 2016 um 04:59
6
How can I do that, then? The admin UI does not offer this option.
Will they return to normal if they ever log in?
zogstrip
(Régis Hanol)
21. Juni 2016 um 08:21
7
fefrei:
How can I do that, then?
You’ll have to use the rails console or run a SQL query.
Yes.
1 „Gefällt mir“
fefrei
(Felix Freiberger)
21. Juni 2016 um 09:11
8
zogstrip:
Yes.
Hm, it looks like this doesn’t work.
I had a non-active, staged user (that had been disabled via the interface and staged via Rails). After the user logged in (via SSO), he had to confirm has address, became active and could log in, but is still staged:
1 „Gefällt mir“
zogstrip
(Régis Hanol)
21. Juni 2016 um 09:16
9
Hmm, it might not unstage when using SSO. Having a look.
2 „Gefällt mir“
fefrei
(Felix Freiberger)
21. Juni 2016 um 09:22
10
Thanks a lot!
In the meantime, for anyone who wants to try the same approach, here’s what I ran on the rails console (rails c
inside the container):
User.where({ active: false }).update_all({ staged: true })
1 „Gefällt mir“
zogstrip
(Régis Hanol)
21. Juni 2016 um 09:24
11
You can do slightly shorter
User.where(active: false).update_all(staged: true)
2 „Gefällt mir“
fefrei
(Felix Freiberger)
21. Juni 2016 um 09:25
12
I’ve given up understanding Ruby’s syntax a long time ago – even my version took many tries to be correct. Thanks for the shorter version
zogstrip
(Régis Hanol)
21. Juni 2016 um 09:29
13
4 „Gefällt mir“
fefrei
(Felix Freiberger)
21. Juni 2016 um 09:54
14
After a journey into tests-passed
lands, I can confirm this is fixed. Thanks a lot!
3 „Gefällt mir“