Skip to content

Commit

Permalink
Merge pull request #7620 from fjordllc/feature/add-field-for-editor-i…
Browse files Browse the repository at this point in the history
…n-profile

プロフィールの「使用しているエディタ」の項目にハッシュが表示されてしまうため、エディタ登録前は空欄になるようにした。
  • Loading branch information
komagata authored Apr 2, 2024
2 parents 42a627b + d5fa536 commit 5b99729
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/decorators/user_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def other_editor_checked?(editors)
end

def editor_or_other_editor
return nil if editor.nil?

editor == 'other_editor' ? other_editor : t("activerecord.enums.user.editor.#{editor}")
end
end
1 change: 1 addition & 0 deletions test/decorators/user_decorator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class UserDecoratorTest < ActiveDecoratorTestCase
@admin_mentor_user.editor = 99
@student_user.editor = 0

assert_equal @japanese_user.editor, nil
assert_equal @admin_mentor_user.editor_or_other_editor, 'textbringer'
assert_equal @student_user.editor_or_other_editor, 'VSCode'
end
Expand Down

0 comments on commit 5b99729

Please sign in to comment.