]> Untitled Git - lemmy-ui.git/commitdiff
Adding the email_admins for new application config. (#742)
authorDessalines <dessalines@users.noreply.github.com>
Tue, 27 Sep 2022 19:45:42 +0000 (15:45 -0400)
committerGitHub <noreply@github.com>
Tue, 27 Sep 2022 19:45:42 +0000 (15:45 -0400)
src/shared/components/home/site-form.tsx

index 74eef0a33eb0a02d3c5b22f87cf2ccb58d2a1d2e..bc0072c48a1e8d47aaa742c1382da99356066a96 100644 (file)
@@ -53,6 +53,7 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
       legal_information: None,
       description: None,
       community_creation_admin_only: None,
+      application_email_admins: None,
       auth: undefined,
       hide_modlog_mod_names: Some(true),
     }),
@@ -101,6 +102,7 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
           default_theme: Some(site.default_theme),
           default_post_listing_type: Some(site.default_post_listing_type),
           legal_information: site.legal_information,
+          application_email_admins: Some(site.application_email_admins),
           hide_modlog_mod_names: site.hide_modlog_mod_names,
           auth: undefined,
         }),
@@ -388,6 +390,30 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
               </div>
             </div>
           </div>
+          <div className="form-group row">
+            <div className="col-12">
+              <div className="form-check">
+                <input
+                  className="form-check-input"
+                  id="create-site-application-email-admins"
+                  type="checkbox"
+                  checked={toUndefined(
+                    this.state.siteForm.application_email_admins
+                  )}
+                  onChange={linkEvent(
+                    this,
+                    this.handleSiteApplicationEmailAdmins
+                  )}
+                />
+                <label
+                  className="form-check-label"
+                  htmlFor="create-site-email-admins"
+                >
+                  {i18n.t("application_email_admins")}
+                </label>
+              </div>
+            </div>
+          </div>
           <div className="form-group row">
             <div className="col-12">
               <label
@@ -527,6 +553,7 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
         private_instance: sForm.private_instance,
         default_theme: sForm.default_theme,
         default_post_listing_type: sForm.default_post_listing_type,
+        application_email_admins: sForm.application_email_admins,
         auth: auth().unwrap(),
         hide_modlog_mod_names: sForm.hide_modlog_mod_names,
       });
@@ -587,6 +614,11 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
     i.setState(i.state);
   }
 
+  handleSiteApplicationEmailAdmins(i: SiteForm, event: any) {
+    i.state.siteForm.application_email_admins = Some(event.target.checked);
+    i.setState(i.state);
+  }
+
   handleSitePrivateInstance(i: SiteForm, event: any) {
     i.state.siteForm.private_instance = Some(event.target.checked);
     i.setState(i.state);