From fb83f48adf5c0c2100c1dd504145e8ea1ccb3314 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sun, 5 Mar 2023 13:48:59 +0100 Subject: [PATCH] Fix lint errors --- app/models/subscription.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/models/subscription.rb b/app/models/subscription.rb index 6d6af38e..a94d95ab 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Subscription < ApplicationRecord belongs_to :user belongs_to :answer @@ -11,18 +13,15 @@ class Subscription < ApplicationRecord end def unsubscribe(recipient, target) - if recipient.nil? or target.nil? - return nil - end + return nil if recipient.nil? || target.nil? subs = Subscription.find_by(user: recipient, answer: target) subs&.destroy end def destruct(target) - if target.nil? - return nil - end + return nil if target.nil? + Subscription.where(answer: target).destroy_all end @@ -37,7 +36,7 @@ class Subscription < ApplicationRecord end def denotify(source, target) - return nil if source.nil? or target.nil? + return nil if source.nil? || target.nil? subs = Subscription.where(answer: target) Notification.where(target:, recipient: subs.map(&:user)).delete_all