Skip to content

Commit

Permalink
Better error handling for unblock_user method
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosba committed Feb 7, 2024
1 parent ebe1d95 commit 6ba2270
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/concerns/smooch_blocking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ def block_user(uid)
end

def unblock_user(uid)
BlockedTiplineUser.where(uid: uid).last.destroy!
Rails.logger.info("[Smooch Bot] Unblocked user #{uid}")
Rails.cache.delete("smooch:banned:#{uid}")
blocked_user = BlockedTiplineUser.where(uid: uid).last
blocked_user.destroy! unless blocked_user.nil?
Rails.logger.info("[Smooch Bot] Unblocked user #{uid}")
end

def user_blocked?(uid)
Expand Down

0 comments on commit 6ba2270

Please sign in to comment.