Conversation
38117be to
31c2ce1
Compare
|
@thmz337 お疲れ様です! ご都合が合えばレビューを行っていただけませんでしょうか? ご検討よろしくお願いします🙇 |
|
ご指名ありがとうございます! |
|
@thmz337 二週間ほど経過していますがこちらのレビューいかがでしょうか。 |
|
ご連絡ありがとうございます。 |
|
@thmz337 僕の方はそのスケジュール感でまったく問題ありません🙏 引き続きよろしくお願いします🙇 |
|
@riq0h |
| before_action :set_article, only: %i[show edit update destroy] | ||
| skip_before_action :require_active_user_login, raise: false, only: %i[index show] | ||
| before_action :require_admin_or_mentor_login, except: %i[index show] | ||
| before_action -> { require_admin_or_mentor_login if params[:tag] }, only: %i[index] |
There was a problem hiding this comment.
こちらの変更点について、今回の修正と関係があるものなのでしょうか。
There was a problem hiding this comment.
多くのgemのバージョンが上がっていますが、問題なかったでしょうか。
| # frozen_string_literal: true | ||
|
|
||
| class API::InquiriesController < API::BaseController | ||
| def index |
There was a problem hiding this comment.
indexメソッドは使用されていますでしょうか。
| end | ||
|
|
||
| create_table "categories", id: :serial, force: :cascade do |t| | ||
| t.string "name", limit: 255 |
There was a problem hiding this comment.
「limit: 255」が軒並み消えていますが、問題ないでしょうか。
|
|
||
| def receiver | ||
| checkable.user | ||
| checkable.respond_to?(:user) ? checkable.user : nil |
There was a problem hiding this comment.
checkableにuserメソッドが実装されていない場合、nilが返されるので、変更する必要がない気がします。
There was a problem hiding this comment.
inquiry.rbにuserメソッドを実装するか、ここで明示的にnilを返す形にしないと以下のようにNoMethodErrorが発生してしまうため加えています。両方を実装していたのは余計でした。
NoMethodError (undefined method user' for #<Inquiry id: 657618196, name: "inquiry2", email: "inquiry2@example.com", body: "お問い合わせのテスト2です。", created_at: "2017-01-01 09:00:00.000000000 +0900", updated_at: "2025-05-18 18:46:10.031782079 +0900", action_completed: true>): 18:46:10 rails.1 | 18:46:10 rails.1 | app/models/check.rb:13:in receiver'
18:46:10 rails.1 | app/models/check_callbacks.rb:5:in after_create' 18:46:10 rails.1 | app/controllers/api/inquiries_controller.rb:8:in update'
There was a problem hiding this comment.
確認したところ、おっしゃる通りでした。失礼しました。
こちらで問題ないかと思います。
app/models/check_callbacks.rb
Outdated
| class CheckCallbacks | ||
| def after_create(check) | ||
| if check.sender != check.receiver && check.checkable_type != 'Report' | ||
| if check.receiver && check.sender != check.receiver && check.checkable_type != 'Report' && check.checkable_type != 'Inquiry' |
There was a problem hiding this comment.
Inquiryにおいてはreceiverがnilを返すので、check.checkable_type != 'Inquiry'まで到達しないと考えます。
よって不要ではないでしょうか。
There was a problem hiding this comment.
これがないと以下のようにバリデーションが失敗してしまうんですよね……。
GoodJob::Execution Update (0.5ms) UPDATE "good_jobs" SET "finished_at" = $1, "error" = $2, "updated_at" = $3 WHERE "good_jobs"."id" = $4 [["finished_at", "2025-05-18 09:38:01.802638"], ["error", "ActiveRecord::RecordInvalid: バリデーションに失敗しました: Userを入力してください"], ["updated_at", "2025-05-18 09:38:01.802908"], ["id", "d3dcf657-7967-45a5-b92d-c9066330beb4"]]
There was a problem hiding this comment.
バリデーションが失敗するのはどのような操作を行なった時になりますでしょうか?
There was a problem hiding this comment.
&& check.checkable_type != 'Inquiry'の箇所を削除して対応済みボタンを押したのですが、
問題なさそうです。
There was a problem hiding this comment.
あれ? 本当ですね……ではこの点はすぐに修正し、pushいたします。
There was a problem hiding this comment.
修正ありがとうございます。
確認し問題ございませんでした。
app/models/inquiry.rb
Outdated
| scope :action_completed, -> { where(action_completed: true) } | ||
| scope :not_completed, -> { where(action_completed: false) } | ||
|
|
||
| def user |
There was a problem hiding this comment.
app/models/check.rbのrecieverメソッドで、こちらのuserメソッドを実装する・しないに関わらずnilを返すので、
不要な気がしますがいかがでしょうか。
|
お疲れ様です。レビュー遅くなってしまい、申し訳ございませんでした。 |
0e7de8b to
0d46255
Compare
|
@thmz337 お疲れ様です! ご指摘いただいた不適切な箇所は削除し、そうでないと思われる箇所については返信を行いました🙏 お手隙の際に再度のレビューをよろしくお願いします🙇 |
0d46255 to
fcc10d3
Compare
Issue
#8465
概要
管理者画面のお問い合わせ一覧と個別ページに「対応済」スタンプを付けられるように実装しました。
変更確認方法
feature/add-completed-stampをローカルに取り込む。・
git fetch origin feature/add-completed-stamp・
git checkout feature/add-completed-stamp・ユーザー名
komagata、パスワードtesttestでログインする。Screenshot
変更前
変更後
Summary by CodeRabbit
新機能
UIの改善
パフォーマンス改善
バグ修正
内部処理の改善