Merge remote-tracking branch 'parent/main' into upstream-20240218

This commit is contained in:
KMY 2024-02-20 09:25:49 +09:00
commit 7684b5de6f
47 changed files with 412 additions and 115 deletions

View file

@ -3,7 +3,9 @@
class MigrateSettingsToUserRoles < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
class UserRole < ApplicationRecord; end
class UserRole < ApplicationRecord
EVERYONE_ROLE_ID = -99
end
def up
process_role_everyone
@ -17,7 +19,7 @@ class MigrateSettingsToUserRoles < ActiveRecord::Migration[6.1]
private
def process_role_everyone
everyone_role = UserRole.find_by(id: -99)
everyone_role = UserRole.find_by(id: UserRole::EVERYONE_ROLE_ID)
return unless everyone_role
everyone_role.permissions &= ~::UserRole::FLAGS[:invite_users] unless min_invite_role == 'user'