Merge commit 'fe2667bb0d3487a32b9da5250402a90482a85fe2' into glitch-soc/merge-upstream
Conflicts: - `app/lib/content_security_policy.rb`: Conflict caused by glitch-soc's support for the extra `EXTRA_DATA_HOSTS` environment variable. Ported upstream's changes while keeping support for `EXTRA_DATA_HOSTS`.
This commit is contained in:
commit
0b2c7cdb02
116 files changed
+873
-518
No files matched your search
@@ -22,11 +22,9 @@ class TruncatePreviewCards < ActiveRecord::Migration[5.1]
|
||||
end
|
||||
|
||||
def down
|
||||
if ActiveRecord::Base.connection.table_exists? 'deprecated_preview_cards'
|
||||
drop_table :preview_cards
|
||||
rename_table :deprecated_preview_cards, :preview_cards
|
||||
else
|
||||
raise ActiveRecord::IrreversibleMigration, 'Previous preview cards table has already been removed'
|
||||
end
|
||||
raise ActiveRecord::IrreversibleMigration, 'Previous preview cards table has already been removed' unless ActiveRecord::Base.connection.table_exists? 'deprecated_preview_cards'
|
||||
|
||||
drop_table :preview_cards
|
||||
rename_table :deprecated_preview_cards, :preview_cards
|
||||
end
|
||||
end
|
||||
@@ -105,7 +105,7 @@ class MigrateAccountConversations < ActiveRecord::Migration[5.2]
|
||||
end
|
||||
end
|
||||
|
||||
notifications_about_direct_statuses.includes(:account, mention: { status: [:account, mentions: :account] }).find_each do |notification|
|
||||
notifications_about_direct_statuses.includes(:account, mention: { status: [:account, { mentions: :account }] }).find_each do |notification|
|
||||
MigrationAccountConversation.add_status(notification.account, notification.target_status)
|
||||
migrated += 1
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class PreserveOldLayoutForExistingUsers < ActiveRecord::Migration[5.2]
|
||||
# on the to-be-changed default
|
||||
|
||||
User.where(User.arel_table[:current_sign_in_at].gteq(1.month.ago)).find_each do |user|
|
||||
next if Setting.unscoped.where(thing_type: 'User', thing_id: user.id, var: 'advanced_layout').exists?
|
||||
next if Setting.unscoped.exists?(thing_type: 'User', thing_id: user.id, var: 'advanced_layout')
|
||||
|
||||
user.settings.advanced_layout = true
|
||||
end
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddAllowWithApprovalToEmailDomainBlocks < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
add_column :email_domain_blocks, :allow_with_approval, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
||||
@@ -6,36 +6,55 @@ class MigrateSettingsToUserRoles < ActiveRecord::Migration[6.1]
|
||||
class UserRole < ApplicationRecord; end
|
||||
|
||||
def up
|
||||
owner_role = UserRole.find_by(name: 'Owner')
|
||||
admin_role = UserRole.find_by(name: 'Admin')
|
||||
moderator_role = UserRole.find_by(name: 'Moderator')
|
||||
everyone_role = UserRole.find_by(id: -99)
|
||||
|
||||
min_invite_role = Setting.min_invite_role
|
||||
show_staff_badge = Setting.show_staff_badge
|
||||
|
||||
if everyone_role
|
||||
everyone_role.permissions &= ~::UserRole::FLAGS[:invite_users] unless min_invite_role == 'user'
|
||||
everyone_role.save
|
||||
end
|
||||
|
||||
if owner_role
|
||||
owner_role.highlighted = show_staff_badge
|
||||
owner_role.save
|
||||
end
|
||||
|
||||
if admin_role
|
||||
admin_role.permissions |= ::UserRole::FLAGS[:invite_users] if %w(admin moderator).include?(min_invite_role)
|
||||
admin_role.highlighted = show_staff_badge
|
||||
admin_role.save
|
||||
end
|
||||
|
||||
if moderator_role
|
||||
moderator_role.permissions |= ::UserRole::FLAGS[:invite_users] if %w(moderator).include?(min_invite_role)
|
||||
moderator_role.highlighted = show_staff_badge
|
||||
moderator_role.save
|
||||
end
|
||||
process_role_everyone
|
||||
process_role_owner
|
||||
process_role_admin
|
||||
process_role_moderator
|
||||
end
|
||||
|
||||
def down; end
|
||||
|
||||
private
|
||||
|
||||
def process_role_everyone
|
||||
everyone_role = UserRole.find_by(id: -99)
|
||||
return unless everyone_role
|
||||
|
||||
everyone_role.permissions &= ~::UserRole::FLAGS[:invite_users] unless min_invite_role == 'user'
|
||||
everyone_role.save
|
||||
end
|
||||
|
||||
def process_role_owner
|
||||
owner_role = UserRole.find_by(name: 'Owner')
|
||||
return unless owner_role
|
||||
|
||||
owner_role.highlighted = show_staff_badge
|
||||
owner_role.save
|
||||
end
|
||||
|
||||
def process_role_admin
|
||||
admin_role = UserRole.find_by(name: 'Admin')
|
||||
return unless admin_role
|
||||
|
||||
admin_role.permissions |= ::UserRole::FLAGS[:invite_users] if %w(admin moderator).include?(min_invite_role)
|
||||
admin_role.highlighted = show_staff_badge
|
||||
admin_role.save
|
||||
end
|
||||
|
||||
def process_role_moderator
|
||||
moderator_role = UserRole.find_by(name: 'Moderator')
|
||||
return unless moderator_role
|
||||
|
||||
moderator_role.permissions |= ::UserRole::FLAGS[:invite_users] if %w(moderator).include?(min_invite_role)
|
||||
moderator_role.highlighted = show_staff_badge
|
||||
moderator_role.save
|
||||
end
|
||||
|
||||
def min_invite_role
|
||||
Setting.min_invite_role
|
||||
end
|
||||
|
||||
def show_staff_badge
|
||||
Setting.show_staff_badge
|
||||
end
|
||||
end
|
||||
+2
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2023_12_12_073317) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2023_12_22_100226) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@@ -435,6 +435,7 @@ ActiveRecord::Schema[7.1].define(version: 2023_12_12_073317) do
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.bigint "parent_id"
|
||||
t.boolean "allow_with_approval", default: false, null: false
|
||||
t.index ["domain"], name: "index_email_domain_blocks_on_domain", unique: true
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user