mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-23 16:44:04 -05:00
Merge commit '3389c41b5899c1da479bfc08e84588184e09902d' into glitch-soc/merge-upstream
Conflicts: - `app/javascript/packs/admin.tsx`: Changes applied to `app/javascript/core/admin.ts` instead.
This commit is contained in:
commit
f01605c665
4
.github/codecov.yml
vendored
4
.github/codecov.yml
vendored
@ -1,3 +1,4 @@
|
||||
comment: false # Do not leave PR comments
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
@ -8,6 +9,3 @@ coverage:
|
||||
default:
|
||||
# Github status check is not blocking
|
||||
informational: true
|
||||
comment:
|
||||
# Only write a comment in PR if there are changes
|
||||
require_changes: true
|
||||
|
@ -150,7 +150,7 @@ Rails.delegate(
|
||||
},
|
||||
);
|
||||
|
||||
const onDomainBlockSeverityChange = (target: HTMLInputElement) => {
|
||||
const onDomainBlockSeverityChange = (target: HTMLSelectElement) => {
|
||||
const rejectMediaDiv = document.querySelector(
|
||||
'.input.with_label.domain_block_reject_media',
|
||||
);
|
||||
@ -170,7 +170,7 @@ const onDomainBlockSeverityChange = (target: HTMLInputElement) => {
|
||||
};
|
||||
|
||||
Rails.delegate(document, '#domain_block_severity', 'change', ({ target }) => {
|
||||
if (target instanceof HTMLInputElement) onDomainBlockSeverityChange(target);
|
||||
if (target instanceof HTMLSelectElement) onDomainBlockSeverityChange(target);
|
||||
});
|
||||
|
||||
const onEnableBootstrapTimelineAccountsChange = (target: HTMLInputElement) => {
|
||||
@ -207,7 +207,7 @@ Rails.delegate(
|
||||
},
|
||||
);
|
||||
|
||||
const onChangeRegistrationMode = (target: HTMLInputElement) => {
|
||||
const onChangeRegistrationMode = (target: HTMLSelectElement) => {
|
||||
const enabled = target.value === 'approved';
|
||||
|
||||
document
|
||||
@ -257,16 +257,16 @@ Rails.delegate(
|
||||
'#form_admin_settings_registrations_mode',
|
||||
'change',
|
||||
({ target }) => {
|
||||
if (target instanceof HTMLInputElement) onChangeRegistrationMode(target);
|
||||
if (target instanceof HTMLSelectElement) onChangeRegistrationMode(target);
|
||||
},
|
||||
);
|
||||
|
||||
ready(() => {
|
||||
const domainBlockSeverityInput = document.querySelector<HTMLInputElement>(
|
||||
'input#domain_block_severity',
|
||||
const domainBlockSeveritySelect = document.querySelector<HTMLSelectElement>(
|
||||
'select#domain_block_severity',
|
||||
);
|
||||
if (domainBlockSeverityInput)
|
||||
onDomainBlockSeverityChange(domainBlockSeverityInput);
|
||||
if (domainBlockSeveritySelect)
|
||||
onDomainBlockSeverityChange(domainBlockSeveritySelect);
|
||||
|
||||
const enableBootstrapTimelineAccounts =
|
||||
document.querySelector<HTMLInputElement>(
|
||||
@ -275,8 +275,8 @@ ready(() => {
|
||||
if (enableBootstrapTimelineAccounts)
|
||||
onEnableBootstrapTimelineAccountsChange(enableBootstrapTimelineAccounts);
|
||||
|
||||
const registrationMode = document.querySelector<HTMLInputElement>(
|
||||
'input#form_admin_settings_registrations_mode',
|
||||
const registrationMode = document.querySelector<HTMLSelectElement>(
|
||||
'select#form_admin_settings_registrations_mode',
|
||||
);
|
||||
if (registrationMode) onChangeRegistrationMode(registrationMode);
|
||||
|
||||
|
@ -39,6 +39,7 @@ class UserRole < ApplicationRecord
|
||||
}.freeze
|
||||
|
||||
EVERYONE_ROLE_ID = -99
|
||||
NOBODY_POSITION = -1
|
||||
|
||||
module Flags
|
||||
NONE = 0
|
||||
@ -104,7 +105,7 @@ class UserRole < ApplicationRecord
|
||||
has_many :users, inverse_of: :role, foreign_key: 'role_id', dependent: :nullify
|
||||
|
||||
def self.nobody
|
||||
@nobody ||= UserRole.new(permissions: Flags::NONE, position: -1)
|
||||
@nobody ||= UserRole.new(permissions: Flags::NONE, position: NOBODY_POSITION)
|
||||
end
|
||||
|
||||
def self.everyone
|
||||
@ -173,7 +174,7 @@ class UserRole < ApplicationRecord
|
||||
end
|
||||
|
||||
def set_position
|
||||
self.position = -1 if everyone?
|
||||
self.position = NOBODY_POSITION if everyone?
|
||||
end
|
||||
|
||||
def validate_own_role_edition
|
||||
|
@ -139,7 +139,7 @@ RSpec.describe UserRole do
|
||||
end
|
||||
|
||||
it 'has negative position' do
|
||||
expect(subject.position).to eq(-1)
|
||||
expect(subject.position).to eq(described_class::NOBODY_POSITION)
|
||||
end
|
||||
end
|
||||
|
||||
@ -159,7 +159,7 @@ RSpec.describe UserRole do
|
||||
end
|
||||
|
||||
it 'has negative position' do
|
||||
expect(subject.position).to eq(-1)
|
||||
expect(subject.position).to eq(described_class::NOBODY_POSITION)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user