From f721886da3fe76aea73fe72b28517e492b537dc1 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Thu, 2 Oct 2025 23:45:19 +0200 Subject: [PATCH] stree --- app/controllers/invites_controller.rb | 5 +---- app/models/discourse_connect.rb | 8 ++------ app/models/notification.rb | 4 +--- .../scripts/group_category_notification_default.rb | 4 +--- plugins/chat/lib/chat/post_notification_handler.rb | 4 +--- 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 6b0c6473608..7f046bd96e2 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -459,10 +459,7 @@ class InvitesController < ApplicationController return render_json_error(I18n.t("rate_limiter.slow_down")) end - Invite - .pending(current_user) - .where.not(email: nil) - .find_each { |invite| invite.resend_invite } + Invite.pending(current_user).where.not(email: nil).find_each { |invite| invite.resend_invite } render json: success_json end diff --git a/app/models/discourse_connect.rb b/app/models/discourse_connect.rb index 53692e46cc8..ae50103d677 100644 --- a/app/models/discourse_connect.rb +++ b/app/models/discourse_connect.rb @@ -190,14 +190,10 @@ class DiscourseConnect < DiscourseConnectBase desired_groups = Group.where("LOWER(NAME) in (?) AND NOT automatic", names) to_be_added = desired_groups - if current_groups.present? - to_be_added = to_be_added.where.not(id: current_groups.map(&:id)) - end + to_be_added = to_be_added.where.not(id: current_groups.map(&:id)) if current_groups.present? to_be_removed = current_groups - if desired_groups.present? - to_be_removed = to_be_removed.where.not(id: desired_groups.map(&:id)) - end + to_be_removed = to_be_removed.where.not(id: desired_groups.map(&:id)) if desired_groups.present? if to_be_added.present? || to_be_removed.present? GroupUser.transaction do diff --git a/app/models/notification.rb b/app/models/notification.rb index 37309c15c21..1d5cc9e08c1 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -308,9 +308,7 @@ class Notification < ActiveRecord::Base [ Notification.types[:liked], Notification.types[:liked_consolidated], - ].each do |notification_type| - notifications = notifications.where.not(notification_type:) - end + ].each { |notification_type| notifications = notifications.where.not(notification_type:) } end notifications = notifications.to_a diff --git a/plugins/automation/lib/discourse_automation/scripts/group_category_notification_default.rb b/plugins/automation/lib/discourse_automation/scripts/group_category_notification_default.rb index 83eeb439dce..1424b2e2fc2 100644 --- a/plugins/automation/lib/discourse_automation/scripts/group_category_notification_default.rb +++ b/plugins/automation/lib/discourse_automation/scripts/group_category_notification_default.rb @@ -37,9 +37,7 @@ DiscourseAutomation::Scriptable.add( category_users = [] existing_users = - CategoryUser - .where(category_id:, user_id: user_ids) - .where.not(notification_level: nil) + CategoryUser.where(category_id:, user_id: user_ids).where.not(notification_level: nil) skip_user_ids = existing_users.pluck(:user_id) batch.each do |group_user| diff --git a/plugins/chat/lib/chat/post_notification_handler.rb b/plugins/chat/lib/chat/post_notification_handler.rb index 2da850a9bd4..8de6677e2c2 100644 --- a/plugins/chat/lib/chat/post_notification_handler.rb +++ b/plugins/chat/lib/chat/post_notification_handler.rb @@ -19,9 +19,7 @@ module Chat return false if post.topic.private_message? quoted_users = extract_quoted_users(post) - if @notified_users.present? - quoted_users = quoted_users.where.not(id: @notified_users) - end + quoted_users = quoted_users.where.not(id: @notified_users) if @notified_users.present? opts = { user_id: post.user.id, display_username: post.user.username } quoted_users.each do |user|