I updated the rake task so that it logs a “merge user” action instead of “delete user” in the staff logs.
I’m little bit confused. I don’t have
users:merge task in my docker container. Does it already in
v2.1.0.beta2 +16 version?
Yes, it’s part of Discourse since 2.0.0.beta4
Hm. Here what I have when I run
And I rebuild discourse container in a last week.
Oh, I see. The task doesn’t show up in that list because it doesn’t have a description. I’m going to add one.
But you should be able to execute the task as shown in the first post:
Here is what I have:
root@host:/var/www/discourse# rake users:merge['source','target'] rake aborted! PG::UndefinedFunction: ОШИБКА: функция jsonb_build_object(unknown, text, unknown, text, unknown, text, unknown, text) не существует LINE 4: jsonb_build_object( ^ HINT: Функция с данными именем и типами аргументов не найдена. Возможно, вам следует добавить явные приведения типов. /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/pg.rb:92:in `async_exec' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/pg.rb:92:in `async_exec' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/mini_sql-0.1.9/lib/mini_sql/connection.rb:104:in `run' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/mini_sql-0.1.9/lib/mini_sql/connection.rb:76:in `exec' /var/www/discourse/app/jobs/regular/update_username.rb:63:in `update_notifications' /var/www/discourse/app/jobs/regular/update_username.rb:22:in `execute' /var/www/discourse/app/services/username_changer.rb:46:in `update_username' /var/www/discourse/app/services/user_merger.rb:30:in `update_username' /var/www/discourse/app/services/user_merger.rb:10:in `merge!' /var/www/discourse/lib/tasks/users.rake:47:in `block in <top (required)>' /usr/local/bin/bundle:23:in `load' /usr/local/bin/bundle:23:in `<main>' Tasks: TOP => users:merge (See full trace by running task with --trace)
ERROR: function jsonb_build_object(unknown, text, unknown, text, unknown, text, unknown, text) doesn't exist
You need to upgrade PostgreSQL to version 9.5 or greater. The current docker container uses Postgres 10 by default.
Ou, I see now. Thank you very much!
The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.
Disabling the plugin solves the problem, but I like the plugin, so ideas on how I could fix it are very welcome!
The line in question is at https://github.com/discourse/discourse-voting/blob/master/plugin.rb#L112 and I think I’ve fixed it at https://github.com/discourse/discourse-voting/pull/33.
Maybe. Plugins can subscribe to the
:merging_users event. It’s possible that the Voting plugin needs to do that.
Just found out about this and immediately tried it out. Works like a charm. Thank you for this nice feature!
Is there any way to empty the second emails field? I merged two users and then later realized I should not have done so. Now I can’t create the user again because the email address is in the second emails field.
Obviously some sort of UI fix would be lovely long term for emptying/changing these addresses, but I know that’s likely a ways off. In the meantime I’d be grateful for command line steps. Thanks in advance!
Sure, this can be done in the rails console within the container.
rails c # restrict to secondary emails, just in case you try to delete the wrong email UserEmail.where(email: "firstname.lastname@example.org", primary: false).destroy_all # probably not needed, but better safe than sorry EmailToken.where(email: "email@example.com").destroy_all
This is helpful. This seems like something that people will need with some frequency; it’d probably be good if this were a rake task.