fix: Subscription attribute update issue (#2951)
This commit is contained in:
parent
a03ed4eea0
commit
ff1625708e
1 changed files with 6 additions and 2 deletions
|
@ -4,7 +4,7 @@ class NotificationSubscriptionBuilder
|
||||||
def perform
|
def perform
|
||||||
# if multiple accounts were used to login in same browser
|
# if multiple accounts were used to login in same browser
|
||||||
move_subscription_to_user if identifier_subscription && identifier_subscription.user_id != user.id
|
move_subscription_to_user if identifier_subscription && identifier_subscription.user_id != user.id
|
||||||
build_identifier_subscription if identifier_subscription.blank?
|
identifier_subscription.blank? ? build_identifier_subscription : update_identifier_subscription
|
||||||
identifier_subscription
|
identifier_subscription
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,6 +25,10 @@ class NotificationSubscriptionBuilder
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_identifier_subscription
|
def build_identifier_subscription
|
||||||
user.notification_subscriptions.create(params.merge(identifier: identifier))
|
@identifier_subscription = user.notification_subscriptions.create(params.merge(identifier: identifier))
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_identifier_subscription
|
||||||
|
identifier_subscription.update(params.merge(identifier: identifier))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue