about summary refs log tree commit diff
path: root/app/javascript/packs/admin.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-09-03 22:53:27 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-09-03 22:53:27 +0200
commitc1e238a77b1f92a031fcb644c2d37809b96e9027 (patch)
treebbc26cad6cfb852450258b5202916e468b79a8f7 /app/javascript/packs/admin.js
parent692c5b439ae8659e459da692cf9e6b8e6f29d2a1 (diff)
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
Diffstat (limited to 'app/javascript/packs/admin.js')
-rw-r--r--app/javascript/packs/admin.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/javascript/packs/admin.js b/app/javascript/packs/admin.js
index f0c0ee0b7..42c747d2e 100644
--- a/app/javascript/packs/admin.js
+++ b/app/javascript/packs/admin.js
@@ -1,4 +1,5 @@
 import { delegate } from 'rails-ujs';
+import ready from '../mastodon/ready';
 
 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 rejectReportsDiv = document.querySelector('.input.with_label.domain_block_reject_reports');
 
@@ -40,4 +41,11 @@ delegate(document, '#domain_block_severity', 'change', ({ target }) => {
   if (rejectReportsDiv) {
     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);
 });