Estou pensando em importar cerca de 600 endereços de e-mail de uma lista de distribuição para o Discourse, com o objetivo de configurar automaticamente todos para acompanhar a categoria Announcements, que essencialmente cumprirá a função principal da lista de e-mail.
Entendo que, como parte do processo de importação, nós (sei que há scripts envolvidos e precisarei que meu desenvolvedor faça isso) podemos forçar todos os usuários importados a estar acompanhando a categoria Announcements, de modo que eles receberão e-mails para cada postagem (a menos que parem de acompanhá-la manualmente). Isso é verdade?
O que está menos claro para mim é qual será a experiência do usuário para os usuários importados. Eles terão cada um uma conta, mas presumo que não poderão fazer login até definir uma senha, e na primeira vez que visitarem o site, o Discourse solicitará que façam isso. Correto?
E se eles nunca definirem uma senha? (A maioria não percebe que agora possui contas no Mailman; houve resistência em ter que ter outra conta. Suspiro.) Se alguém nunca visitar o site e nunca fizer login, ainda receberá e-mails sobre tópicos e postagens na categoria Announcements?
Para quem já fez isso, que tipo de problemas de suporte vocês tiveram que lidar após a importação?
If you already have a transactional relationship with these folks, i.e., you’re moving them to a new platform, there are ways to shortcut the user creation process. It’s for more advanced admins, but here are some command line (rails console) ideas that could work:
From my experience, this will create the new user with the details you provide, activate their account so they can receive email, and then send them an email letting them know that an account has been created for them on your Discourse site, and gives them a link to set up their account:
A new account was created for you at Your Discourse Site Name
There are smarter people around here than me on this topic, but I think that because you run the u.activate(); command, they’re already fully activated and the only thing they’re doing through the email is changing their password from the initial random string that nobody knows.
There is a notion that inactive users eventually stop getting emails, but I’m not sure if that would come into play here for “auto-watched” categories, I have only really thought of it in terms of the digest/summary recipients. Hopefully someone else can chime on that answer.
Another quick question on imports. Do you know what will happen if you try to import an email address that’s already assigned to a user in the system? Will it just be skipped?
I was afraid you’d say that. The Rails console approach proved vastly beyond my admin capabilities (Rails wasn’t even installed on our VPS, and I couldn’t see how I’d import 600 addresses that way anyway), so I’m having to bring in our developer. I’ll ask him to check.
Thanks! I had to add sudu su before the third line to get permission to connect to the docker daemon, but then it worked and I was able to execute the lines in the Rails script above and create a test user. Yay!
How would this script expand to work with a list of 600 email addresses though? Running it 600 times seems… tedious.
Since no one here had any Ruby experience, we opted for creating a large file of all the commands and pasting them into the Rails console. Seems to work except that there are now four errors in Sidekiq (out of the first 50 test imports), and I don’t know what to do with them or what they mean. Were the users created? Did they just not receive the welcome email? Since retries are failing, should I just delete these errors and move on?
It’s hard for me to imagine how the user_id would be invalid.
Probably so, but you’ll want to figure out which users failed and why. Were there errors when you pasted the commands? If you can’t find that out, you’ll need to look at the users that exist and the ones that you expect to exist and see what the difference is.
If you don’t have easy means to scroll back through the stuff, you should work in smaller batches so that you can check on their progress more easily.
I wasn’t alerted about this until quite a bit later, so there was no way to go back. It’s possible these errors are happening when an imported email address already exists in the system—I can test that. All the users I expected to have created were created.
But what I can’t figure out is if there’s any connection between the information in this screenshot and anything I could look up in Discourse. Are email_tokens something that can be linked back to any other information?
Sounds like I’ll just keep doing this in small batches and see if I can attach an error to one of these messages.
Turns out these errors were generated every time there was an error in the import, things like usernames over 20 character, or two special characters in a row in a username, or possibly the email already being in use (I saw inconsistent results with that one). I just fixed each problem and moved on, and deleted all the errors from Sidekiq at the end.