Fix admin interface showing superfluous reject media/reports on suspended blocks (#11749)
* Fix admin interface showing superfluous reject media/reports on suspended domains * Fix reject media/reports checkboxes being visible when editing domain block of suspend severity
This commit is contained in:
parent
692c5b439a
commit
c1e238a77b
|
@ -1,4 +1,5 @@
|
||||||
import { delegate } from 'rails-ujs';
|
import { delegate } from 'rails-ujs';
|
||||||
|
import ready from '../mastodon/ready';
|
||||||
|
|
||||||
const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]';
|
const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]';
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ delegate(document, '.media-spoiler-hide-button', 'click', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
delegate(document, '#domain_block_severity', 'change', ({ target }) => {
|
const onDomainBlockSeverityChange = (target) => {
|
||||||
const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media');
|
const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media');
|
||||||
const rejectReportsDiv = document.querySelector('.input.with_label.domain_block_reject_reports');
|
const rejectReportsDiv = document.querySelector('.input.with_label.domain_block_reject_reports');
|
||||||
|
|
||||||
|
@ -40,4 +41,11 @@ delegate(document, '#domain_block_severity', 'change', ({ target }) => {
|
||||||
if (rejectReportsDiv) {
|
if (rejectReportsDiv) {
|
||||||
rejectReportsDiv.style.display = (target.value === 'suspend') ? 'none' : 'block';
|
rejectReportsDiv.style.display = (target.value === 'suspend') ? 'none' : 'block';
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
delegate(document, '#domain_block_severity', 'change', ({ target }) => onDomainBlockSeverityChange(target));
|
||||||
|
|
||||||
|
ready(() => {
|
||||||
|
const input = document.getElementById('domain_block_severity');
|
||||||
|
if (input) onDomainBlockSeverityChange(input);
|
||||||
});
|
});
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
- if !instance.domain_block.noop?
|
- if !instance.domain_block.noop?
|
||||||
= t("admin.domain_blocks.severity.#{instance.domain_block.severity}")
|
= t("admin.domain_blocks.severity.#{instance.domain_block.severity}")
|
||||||
- first_item = false
|
- first_item = false
|
||||||
|
- unless instance.domain_block.suspend?
|
||||||
- if instance.domain_block.reject_media?
|
- if instance.domain_block.reject_media?
|
||||||
- unless first_item
|
- unless first_item
|
||||||
•
|
•
|
||||||
|
|
Loading…
Reference in New Issue