Fix lint errors
This commit is contained in:
parent
36d59d100e
commit
fb83f48adf
|
@ -1,3 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Subscription < ApplicationRecord
|
class Subscription < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :answer
|
belongs_to :answer
|
||||||
|
@ -11,18 +13,15 @@ class Subscription < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def unsubscribe(recipient, target)
|
def unsubscribe(recipient, target)
|
||||||
if recipient.nil? or target.nil?
|
return nil if recipient.nil? || target.nil?
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
subs = Subscription.find_by(user: recipient, answer: target)
|
subs = Subscription.find_by(user: recipient, answer: target)
|
||||||
subs&.destroy
|
subs&.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
def destruct(target)
|
def destruct(target)
|
||||||
if target.nil?
|
return nil if target.nil?
|
||||||
return nil
|
|
||||||
end
|
|
||||||
Subscription.where(answer: target).destroy_all
|
Subscription.where(answer: target).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,7 +36,7 @@ class Subscription < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def denotify(source, target)
|
def denotify(source, target)
|
||||||
return nil if source.nil? or target.nil?
|
return nil if source.nil? || target.nil?
|
||||||
|
|
||||||
subs = Subscription.where(answer: target)
|
subs = Subscription.where(answer: target)
|
||||||
Notification.where(target:, recipient: subs.map(&:user)).delete_all
|
Notification.where(target:, recipient: subs.map(&:user)).delete_all
|
||||||
|
|
Loading…
Reference in New Issue