mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00
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:
@ -204,10 +204,8 @@ end
|
|||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
# idx_bookmarks_user_polymorphic_unique (user_id,bookmarkable_type,bookmarkable_id) UNIQUE
|
# 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_at (reminder_at)
|
# index_bookmarks_on_reminder_set_at (reminder_set_at)
|
||||||
# index_bookmarks_on_reminder_set_at (reminder_set_at)
|
# index_bookmarks_on_user_id (user_id)
|
||||||
# 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
|
|
||||||
#
|
#
|
||||||
|
@ -64,9 +64,7 @@ module HasCustomFields
|
|||||||
has_many :_custom_fields, dependent: :destroy, class_name: "#{name}CustomField"
|
has_many :_custom_fields, dependent: :destroy, class_name: "#{name}CustomField"
|
||||||
after_save :save_custom_fields
|
after_save :save_custom_fields
|
||||||
|
|
||||||
# TODO (martin) Post 2.8 release, change to attr_reader because this is
|
attr_reader :preloaded_custom_fields
|
||||||
# set by set_preloaded_custom_fields
|
|
||||||
attr_accessor :preloaded_custom_fields
|
|
||||||
|
|
||||||
def custom_fields_fk
|
def custom_fields_fk
|
||||||
@custom_fields_fk ||= "#{_custom_fields.reflect_on_all_associations(:belongs_to)[0].name}_id"
|
@custom_fields_fk ||= "#{_custom_fields.reflect_on_all_associations(:belongs_to)[0].name}_id"
|
||||||
|
@ -193,8 +193,7 @@ class SiteSetting < ActiveRecord::Base
|
|||||||
|
|
||||||
def self.whispers_allowed_group_ids
|
def self.whispers_allowed_group_ids
|
||||||
if SiteSetting.enable_whispers && SiteSetting.whispers_allowed_groups.present?
|
if SiteSetting.enable_whispers && SiteSetting.whispers_allowed_groups.present?
|
||||||
# TODO (martin) Change to whispers_allowed_groups_map
|
SiteSetting.whispers_allowed_groups_map
|
||||||
SiteSetting.whispers_allowed_groups.split("|").map(&:to_i)
|
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
@ -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
|
@ -15,8 +15,7 @@ module TagGuardian
|
|||||||
return false if @user.blank?
|
return false if @user.blank?
|
||||||
return true if @user == Discourse.system_user
|
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_map
|
||||||
group_ids = SiteSetting.pm_tags_allowed_for_groups.to_s.split("|").map(&:to_i)
|
|
||||||
group_ids.include?(Group::AUTO_GROUPS[:everyone]) || @user.group_users.exists?(group_id: group_ids)
|
group_ids.include?(Group::AUTO_GROUPS[:everyone]) || @user.group_users.exists?(group_id: group_ids)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,13 +13,6 @@ module UploadsHelpers
|
|||||||
stub_request(:head, "https://#{SiteSetting.s3_upload_bucket}.s3.#{SiteSetting.s3_region}.amazonaws.com/")
|
stub_request(:head, "https://#{SiteSetting.s3_upload_bucket}.s3.#{SiteSetting.s3_region}.amazonaws.com/")
|
||||||
end
|
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
|
def enable_secure_uploads
|
||||||
setup_s3
|
setup_s3
|
||||||
SiteSetting.secure_uploads = true
|
SiteSetting.secure_uploads = true
|
||||||
|
Reference in New Issue
Block a user