f1r4s
(Eddie)
January 8, 2022, 9:39am
1
Hello,
I have strange issue with username, my board is using RTL and unique language for Arabic keywords…
The username is set to English words, but when I check the logs it’s show me that the user profile template cannot found… Because it’s in Arabic keywords …
When I check the username to change it’s set to English, but in error it’s show me Arabic keyword…
Here is the full error.
Message
ActionView::Template::Error (No route matches {:action=>"show", :controller=>"users", :username=>"دعم_المجتمع"}, possible unmatched constraints: [:username]
Did you mean? user_url
users_url
users_path
user_badge_url)
app/views/about/index.html.erb:17
app/views/about/index.html.erb:15
app/controllers/about_controller.rb:16:in `block (2 levels) in index'
app/controllers/about_controller.rb:14:in `index'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:354:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:198:in `call'
Backtrace
actionpack (6.1.4.1) lib/action_dispatch/journey/formatter.rb:44:in `path'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:823:in `url_for'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:270:in `call'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:326:in `block in define_url_helper'
app/views/about/index.html.erb:17
activerecord (6.1.4.1) lib/active_record/relation/delegation.rb:88:in `each'
activerecord (6.1.4.1) lib/active_record/relation/delegation.rb:88:in `each'
app/views/about/index.html.erb:15
actionview (6.1.4.1) lib/action_view/base.rb:247:in `public_send'
actionview (6.1.4.1) lib/action_view/base.rb:247:in `_run'
Env
HTTP HOSTS: forum.com
I believe we must fix this from inside container since in admin panel I try everything but not working.
Any suggestions?
f1r4s
(Eddie)
January 10, 2022, 9:21am
2
any suggestion how to apply unique caratars on discourse ? so we can use username’s in arabic language, or with unique utf-8 encoding ?
I’m afraid I don’t have experience with Arabic usernames, but is this a case where the unicode usernames
could help?
f1r4s
(Eddie)
January 10, 2022, 9:58pm
4
Correct, it’s already checked but still the problem; but now error changed;
Message
NoMethodError (undefined method `url' for nil:NilClass)
app/models/badge.rb:306:in `image_url'
(eval):10:in `_fast_attributes'
lib/freedom_patches/ams_include_without_root.rb:54:in `include!'
lib/freedom_patches/ams_include_without_root.rb:54:in `include!'
app/controllers/application_controller.rb:510:in `render_json_dump'
app/controllers/users_controller.rb:97:in `block (2 levels) in show'
app/controllers/users_controller.rb:89:in `show'
app/controllers/users_controller.rb:103:in `show_card'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:356:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:198:in `call'
Backtrace
app/models/badge.rb:306:in `image_url'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:99:in `block in attribute'
(eval):10:in `_fast_attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:468:in `rescue in attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:455:in `attributes'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:480:in `_serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:359:in `serializable_hash'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:448:in `block in merge_association'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:445:in `each'
active_model_serializers (0.8.4) lib/active_model/serializer.rb:445:in `merge_association'
Env
HTTP HOSTS: site.com
f1r4s
(Eddie)
January 11, 2022, 3:16pm
7
Seems the problem in the badge section in my forum; but im trying to run this command on container but i don’t know how;
Discourse.system_user.create_user_profile
This command would fix the badge issue; but i would apprecaite if someone provide how to run this command ? or where ?
[1] pry(main)> Discourse.system_user.create_user_profile
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "user_profiles_pkey"
DETAIL: Key (user_id)=(-1) already exists.
from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:69:in `exec_params'
Caused by PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "user_profiles_pkey"
DETAIL: Key (user_id)=(-1) already exists.
from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:69:in `exec_params'
Thanks.
cocococosti
(Constanza Abarca)
January 11, 2022, 6:52pm
8
Why do you believe so? I don’t think the create_user_profile
method is meant to be run manually, is run by Discourse after a user is created discourse/app/models/user.rb at main · discourse/discourse · GitHub
That is why you get the duplicate key value
error, because you are trying to create user profiles that already exist.
I tried to replicate this error by creating a user account with username دعم_المجتمع and I also tested it with an account with an English username, both had the interface language set to Arabic, and it works fine.
I don’t think this issue is related to the language or templates anymore, but to the badges missing images, as you pointed out here Badge image missing issue
f1r4s
(Eddie)
January 11, 2022, 6:58pm
9
Your correct; anyway this is a backup and i restore it and it’s working fine… the issue only with badge images; and i try to run the command
rake uploads:clean_up
rake posts:rebake
but still same issue…
[2] pry(main)> Discourse.system_user.create_user_profile
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "user_profiles_pkey"
DETAIL: Key (user_id)=(-1) already exists.
from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:69:in `exec_params'
Caused by PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "user_profiles_pkey"
DETAIL: Key (user_id)=(-1) already exists.
from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:69:in `exec_params'
[3] pry(main)>
1 Like