사용자 이름 템플릿을 찾을 수 없음

안녕하세요,

사용자 이름과 관련하여 이상한 문제가 발생했습니다. 제 보드는 RTL을 사용하며, 아랍어 키워드를 위한 고유한 언어 설정이 적용되어 있습니다.

사용자 이름은 영어 단어로 설정되어 있지만, 로그를 확인해 보면 사용자 프로필 템플릿을 찾을 수 없다는 메시지가 표시됩니다. 이는 아랍어 키워드 때문인 것 같습니다.

사용자 이름을 확인하여 변경하려고 하면 영어로 설정되어 있는 것으로 보이지만, 오류 메시지는 아랍어 키워드를 표시하고 있습니다.

전체 오류 메시지는 다음과 같습니다.

메시지

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

관리자 패널에서 모든 것을 시도해 봤지만 작동하지 않아, 컨테이너 내부에서 이 문제를 수정해야 한다고 생각합니다.

제안이 있으신가요?

디스코스에서 고유한 문자를 적용하는 방법에 대한 제안이 있을까요? 아랍어 사용자 이름이나 고유한 UTF-8 인코딩을 사용할 수 있도록 하고 싶습니다.

아랍어 사용자 이름에 대한 경험은 없지만, 이 경우 유니코드 사용자 이름이 도움이 될 수 있을까요?

맞아요, 이미 확인했지만 여전히 문제가 있습니다. 다만 이제 오류가 바뀌었습니다.

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

포럼의 배지 섹션에 문제가 있는 것 같습니다. 하지만 이 명령어를 컨테이너에서 실행하는 방법을 모르겠어요.

Discourse.system_user.create_user_profile

이 명령어를 실행하면 배지 문제를 해결할 수 있을 것 같은데, 이 명령어를 어떻게 실행하는지, 어디서 실행해야 하는지 알려주시면 감사하겠습니다.

[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'

감사합니다.

왜 그렇게 생각하시나요? create_user_profile 메서드는 수동으로 실행하도록 의도된 것이 아니며, 사용자가 생성된 후 Discourse가 자동으로 실행하는 메서드라고 생각합니다. discourse/app/models/user.rb at main · discourse/discourse · GitHub

기존에 이미 존재하는 사용자 프로필을 다시 생성하려고 하시기 때문에 duplicate key value 오류가 발생하는 것입니다.

저는 사용자 이름이 دعم_المجتمع인 계정을 생성하여 이 오류를 재현해 보았고, 영어 사용자 이름으로 된 계정으로 테스트해 보기도 했는데, 두 계정의 인터페이스 언어가 모두 아랍어로 설정되어 있었음에도 문제가 없이 정상 작동했습니다.

여기에서 지적하신 대로 Badge image missing issue 이 문제는 더 이상 언어나 템플릿과 관련이 없고, 배지 이미지가 누락된 것과 관련이 있다고 생각합니다.

맞습니다. 어쨌든 이건 백업이고, 복원한 후 정상적으로 작동하고 있습니다. 문제는 배지 이미지에서만 발생하고 있으며, 다음 명령어를 실행해 보았지만

rake uploads:clean_up
rake posts:rebake

여전히 동일한 문제가 발생합니다..

[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)>