DEV: TODO followups (#18936)

* Remove old bookmark column ignores to follow up b22450c7a8d378b32291743ca602cbc477dea106
* Change some group site setting checks to use the _map helper
* Remove old secure_media helper stub for chat
* Change attr_accessor to attr_reader for preloaded_custom_fields to follow up 70af45055ae24dc7eb1a20678a52ed3ec69421c3
This commit is contained in:
Martin Brennan
2022-11-09 07:48:05 +10:00
committed by GitHub
parent 74a9859a12
commit f8f55cef67
6 changed files with 29 additions and 20 deletions

View File

@ -204,10 +204,8 @@ end
#
# Indexes
#
# idx_bookmarks_user_polymorphic_unique (user_id,bookmarkable_type,bookmarkable_id) UNIQUE
# index_bookmarks_on_post_id (post_id)
# index_bookmarks_on_reminder_at (reminder_at)
# index_bookmarks_on_reminder_set_at (reminder_set_at)
# index_bookmarks_on_user_id (user_id)
# index_bookmarks_on_user_id_and_post_id_and_for_topic (user_id,post_id,for_topic) UNIQUE
# idx_bookmarks_user_polymorphic_unique (user_id,bookmarkable_type,bookmarkable_id) UNIQUE
# index_bookmarks_on_reminder_at (reminder_at)
# index_bookmarks_on_reminder_set_at (reminder_set_at)
# index_bookmarks_on_user_id (user_id)
#

View File

@ -64,9 +64,7 @@ module HasCustomFields
has_many :_custom_fields, dependent: :destroy, class_name: "#{name}CustomField"
after_save :save_custom_fields
# TODO (martin) Post 2.8 release, change to attr_reader because this is
# set by set_preloaded_custom_fields
attr_accessor :preloaded_custom_fields
attr_reader :preloaded_custom_fields
def custom_fields_fk
@custom_fields_fk ||= "#{_custom_fields.reflect_on_all_associations(:belongs_to)[0].name}_id"

View File

@ -193,8 +193,7 @@ class SiteSetting < ActiveRecord::Base
def self.whispers_allowed_group_ids
if SiteSetting.enable_whispers && SiteSetting.whispers_allowed_groups.present?
# TODO (martin) Change to whispers_allowed_groups_map
SiteSetting.whispers_allowed_groups.split("|").map(&:to_i)
SiteSetting.whispers_allowed_groups_map
else
[]
end

View File

@ -0,0 +1,22 @@
# frozen_string_literal: true
require 'migration/column_dropper'
class DropOldBookmarkColumnsV2 < ActiveRecord::Migration[7.0]
DROPPED_COLUMNS ||= {
bookmarks: %i{
post_id
for_topic
}
}
def up
DROPPED_COLUMNS.each do |table, columns|
Migration::ColumnDropper.execute_drop(table, columns)
end
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -15,8 +15,7 @@ module TagGuardian
return false if @user.blank?
return true if @user == Discourse.system_user
# TODO (martin) Change to pm_tags_allowed_for_groups_map
group_ids = SiteSetting.pm_tags_allowed_for_groups.to_s.split("|").map(&:to_i)
group_ids = SiteSetting.pm_tags_allowed_for_groups_map
group_ids.include?(Group::AUTO_GROUPS[:everyone]) || @user.group_users.exists?(group_id: group_ids)
end

View File

@ -13,13 +13,6 @@ module UploadsHelpers
stub_request(:head, "https://#{SiteSetting.s3_upload_bucket}.s3.#{SiteSetting.s3_region}.amazonaws.com/")
end
# TODO (martin) Remove this alias once discourse-chat plugin has been
# updated to use secure_uploads instead.
def enable_secure_media
enable_secure_uploads
DiscourseEvent.trigger(:site_setting_changed, :secure_media, false, true)
end
def enable_secure_uploads
setup_s3
SiteSetting.secure_uploads = true