-
Notifications
You must be signed in to change notification settings - Fork 75
ペアワークのペアもしくは日程変更時の通知とペア取り消し機能を実装 #9812
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
base: main
Are you sure you want to change the base?
Changes from all commits
70f4cb7
c97c2bc
22af76a
a16fa66
a0a988c
5554d5e
b7d636f
484574e
b2354ac
433635b
a6ef8c1
3127ce9
f0f8085
4ca0dde
37df376
d208348
ae6cc27
b056da2
e5e5c71
6b09132
295725c
f1bf11e
538bfbc
e4bb597
8cde432
30ae839
884ce20
3149bb4
96a6e48
ca5e640
e3da2a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class PairWorkCancelNotifier | ||
| def call(_name, _started, _finished, _unique_id, payload) | ||
| notify_watchers(payload[:pair_work], payload[:sender]) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def notify_watchers(pair_work, sender) | ||
| receivers = User.where(id: pair_work.watches.select(:user_id)) | ||
| receivers.each do |receiver| | ||
| ActivityDelivery.with(pair_work:, receiver:, sender:).notify(:cancel_pair_work) | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class PairWorkRematchingNotifier | ||
| def call(_name, _started, _finished, _unique_id, payload) | ||
| pair_work = payload[:pair_work] | ||
| past_buddy = payload[:past_buddy] | ||
| return if pair_work.wip? | ||
|
|
||
| notify_pair_work_creator_and_past_buddy(pair_work, past_buddy) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def notify_pair_work_creator_and_past_buddy(pair_work, past_buddy) | ||
| [pair_work.user, past_buddy].compact.each do |receiver| | ||
| ActivityDelivery.with(pair_work:, receiver:).notify(:rematching_pair_work) | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class PairWorkRescheduleNotifier | ||
| def call(_name, _started, _finished, _unique_id, payload) | ||
| pair_work = payload[:pair_work] | ||
| return if pair_work.wip? | ||
|
|
||
| notify_pair_work_creator(pair_work) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def notify_pair_work_creator(pair_work) | ||
| ActivityDelivery.with(pair_work:, receiver: pair_work.user).notify(:reschedule_pair_work) | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -389,6 +389,54 @@ def matching_pair_work(params = {}) | |
| ) | ||
| end | ||
|
|
||
| def rematching_pair_work(params = {}) | ||
| params.merge!(@params) | ||
| pair_work = params[:pair_work] | ||
| sender = pair_work.buddy | ||
| receiver = params[:receiver] | ||
|
|
||
| notification( | ||
| body: "ペアワーク「#{pair_work.title}」のペアが#{sender.login_name}に変更されました。", | ||
| kind: :rematching_pair_work, | ||
| receiver:, | ||
| sender:, | ||
| link: Rails.application.routes.url_helpers.polymorphic_path(pair_work), | ||
| read: false | ||
| ) | ||
| end | ||
|
|
||
| def reschedule_pair_work(params = {}) | ||
| params.merge!(@params) | ||
| pair_work = params[:pair_work] | ||
| sender = pair_work.buddy | ||
| receiver = params[:receiver] | ||
|
|
||
| notification( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 他の記述と揃えて
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 同ファイル内の他の記述に倣って改行を追加にて修正しました。改行を入れない理由もなかったので他に倣いました🫡 |
||
| body: "ペアワーク「#{pair_work.title}」の日程が#{I18n.l pair_work.reserved_at}に変更されました。", | ||
| kind: :reschedule_pair_work, | ||
| receiver:, | ||
| sender:, | ||
| link: Rails.application.routes.url_helpers.polymorphic_path(pair_work), | ||
| read: false | ||
| ) | ||
| end | ||
|
|
||
| def cancel_pair_work(params = {}) | ||
| params.merge!(@params) | ||
| pair_work = params[:pair_work] | ||
| sender = params[:sender] | ||
| receiver = params[:receiver] | ||
|
|
||
| notification( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 他の記述と揃えて
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #9812 (comment) と同様に修正しました! |
||
| body: "ペアワーク「#{pair_work.title}」のペア確定が取り消されました。", | ||
| kind: :cancel_pair_work, | ||
| receiver:, | ||
| sender:, | ||
| link: Rails.application.routes.url_helpers.polymorphic_path(pair_work), | ||
| read: false | ||
| ) | ||
| end | ||
|
|
||
| def moved_up_event_waiting_user(params = {}) | ||
| params.merge!(@params) | ||
| event = params[:event] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| = render '/notification_mailer/notification_mailer_template', | ||
| title: @title, | ||
| link_url: @link_url, | ||
| link_text: 'ペアワークのページへ' do | ||
| p #{@pair_work.user.login_name}さんのペアワーク【 #{@pair_work.title} 】のペア確定が取り消されました。 | ||
| div(style='border-top: solid 1px #ccc; height: 0;') | ||
| h1(style='margin-top: 1em; border-left: solid 6px #4638a0; padding: 0 0 0 1rem; font-size: 1.5em; border-bottom: none; color: #444444;') | ||
| = @pair_work.title | ||
| = md2html(@pair_work.description) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| = render '/notification_mailer/notification_mailer_template', | ||
| title: @title, | ||
| link_url: @link_url, | ||
| link_text: 'ペアワークのページへ' do | ||
| p ペアワーク【 #{@pair_work.title} 】のペアが#{@pair_work.buddy.login_name}に変更になりました。 | ||
| div(style='border-top: solid 1px #ccc; height: 0;') | ||
| h1(style='margin-top: 1em; border-left: solid 6px #4638a0; padding: 0 0 0 1rem; font-size: 1.5em; border-bottom: none; color: #444444;') | ||
| = @pair_work.title | ||
| = md2html(@pair_work.description) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| = render '/notification_mailer/notification_mailer_template', | ||
| title: @title, | ||
| link_url: @link_url, | ||
| link_text: 'ペアワークのページへ' do | ||
| p ペアワーク【 #{@pair_work.title} 】の日程が#{I18n.l @pair_work.reserved_at}に変更になりました。 | ||
| div(style='border-top: solid 1px #ccc; height: 0;') | ||
| h1(style='margin-top: 1em; border-left: solid 6px #4638a0; padding: 0 0 0 1rem; font-size: 1.5em; border-bottom: none; color: #444444;') | ||
| = @pair_work.title | ||
| = md2html(@pair_work.description) |
Uh oh!
There was an error while loading. Please reload this page.