-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
お知らせにあるWIPの処理をnewspaperに置き換える #5616
お知らせにあるWIPの処理をnewspaperに置き換える #5616
Conversation
app/models/announcement_notifier.rb
Outdated
return if announce.wip? | ||
return unless !announce.wip && announce.published_at.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
もともとafter_first_publish
メソッドは、after_create
とafter_update
メソッドから呼び出されているので、同一条件下で呼び出されるようにしています。
https://github.com/fjordllc/bootcamp/blob/main/app/models/announcement_callbacks.rb#L26
@AyakaTakashima |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akingo55
お疲れ様です!
レビュー依頼ありがとうございます!
動作、コード共に問題ないと思います🎉
approveさせていただきます🙌
@AyakaTakashima @komagata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conflictの修正をお願いします〜
fb596f7
to
c576708
Compare
@komagata |
@akingo55 すみません、またconflictが起こってしまったので修正をお願いします〜 |
9b00164
to
beae3a4
Compare
@komagata |
@@ -0,0 +1,10 @@ | |||
# frozen_string_literal: true | |||
|
|||
class AnnouncementNotifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
やっていることがpublished_atの更新なので、AnnouncementNotifer(お知らせ通知)という名前だと見る人が混乱するかもです。
app/models/announcement_notifier.rb
Outdated
return if announce.wip? | ||
return unless !announce.wip && announce.published_at.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
元々は別々のところにあったコードなので、この条件であればもっとシンプルに書けると思います。
b89d3aa
to
909edab
Compare
@komagata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conflictの修正をお願いします〜。
それと、既にあればOKですが、お知らせのWIPの処理がちゃんと動いているかのテストがなければ追加をお願いします〜
(この処理が間違っていると、お知らせの通知が全ユーザーに飛んでしまったりと影響範囲が大きいためです。)
3ecf1e0
to
fd6b3ef
Compare
@komagata
テストはこちらのPRで追加されていたので、新規追加分はなさそうです。 再レビューお願いします。:pray: |
@komagata |
@@ -18,9 +18,6 @@ class Announcement < ApplicationRecord | |||
belongs_to :user | |||
alias sender user | |||
|
|||
after_create AnnouncementCallbacks.new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
app/models/announcement_notifier.rb
Outdated
@@ -2,6 +2,11 @@ | |||
|
|||
class AnnouncementNotifier | |||
def call(announce) | |||
return if announce.wip? || !announce.published_at.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return if announce.wip? || !announce.published_at.nil? | |
return if announce.wip? || announce.published_at.present? |
二重否定よりこちらの方が良いかもです〜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@komagata
こちら再度確認お願いしますmm
@komagata 確認お願いします! |
@akingo55 マージコミットが含まれているようなので、rebaseの方式で、マージコミットができないようにお願いします〜 |
798db1e
to
afc04b7
Compare
@komagata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
確認させて頂きました。OKです〜🙆♂️
Issue
変更点
お知らせのWIPの処理をnewspaperに置き換えました。
お知らせの新規作成時、更新時にお知らせを公開するときの処理に影響があります。
見た目上、動作上の変更はありません。
確認方法
※ローカルに
feature/replace-announce-processing-from-callback-to-newspaper
ブランチを落として切り替えてください。komagata
でログインしました)bin/rails c
で最新のお知らせを取得し、published_at
に公開日時が入っていることを確認する