From: Dessalines <tyhou13@gmx.com>
Date: Sat, 24 Apr 2021 00:08:38 +0000 (-0400)
Subject: Adding bot acct settings. Fixes #242
X-Git-Url: http://these/git/%22https:/image.com/static/readmes/README.es.md?a=commitdiff_plain;h=affae3d67f465cafa23ad2bee3454eb5eb859db2;p=lemmy-ui.git

Adding bot acct settings. Fixes #242
---

diff --git a/lemmy-translations b/lemmy-translations
index 12e8d61..ef6c991 160000
--- a/lemmy-translations
+++ b/lemmy-translations
@@ -1 +1 @@
-Subproject commit 12e8d61e9ba2620b0031e237d87367480452b6fb
+Subproject commit ef6c991e345a880d98b165508f28793fef3f922a
diff --git a/package.json b/package.json
index 7cc904d..0153a92 100644
--- a/package.json
+++ b/package.json
@@ -68,7 +68,7 @@
     "eslint-plugin-prettier": "^3.3.1",
     "husky": "^6.0.0",
     "iso-639-1": "^2.1.9",
-    "lemmy-js-client": "0.11.0-rc.10",
+    "lemmy-js-client": "0.11.0-rc.11",
     "lint-staged": "^10.5.4",
     "mini-css-extract-plugin": "^1.4.1",
     "node-fetch": "^2.6.1",
diff --git a/src/shared/components/person.tsx b/src/shared/components/person.tsx
index a38a36e..c0ef9f0 100644
--- a/src/shared/components/person.tsx
+++ b/src/shared/components/person.tsx
@@ -439,12 +439,23 @@ export class Person extends Component<any, PersonState> {
                   {i18n.t("logout")}
                 </button>
               ) : (
-                <Link
-                  className={"d-flex align-self-start btn btn-secondary"}
-                  to={`/create_private_message/recipient/${pv.person.id}`}
-                >
-                  {i18n.t("send_message")}
-                </Link>
+                <>
+                  <a
+                    className={`d-flex align-self-start btn btn-secondary mr-2 ${
+                      !pv.person.matrix_user_id && "invisible"
+                    }`}
+                    rel="noopener"
+                    href={`https://matrix.to/#/${pv.person.matrix_user_id}`}
+                  >
+                    {i18n.t("send_secure_message")}
+                  </a>
+                  <Link
+                    className={"d-flex align-self-start btn btn-secondary"}
+                    to={`/create_private_message/recipient/${pv.person.id}`}
+                  >
+                    {i18n.t("send_message")}
+                  </Link>
+                </>
               )}
             </div>
             {pv.person.bio && (
@@ -484,21 +495,6 @@ export class Person extends Component<any, PersonState> {
     );
   }
 
-  // TODO this isn't used currently
-  // matrixButton() {
-  //   return (
-  //     <a
-  //     className={`d-flex align-self-start btn btn-secondary mr-2 ${
-  //       !pv.local_user.matrix_user_id && "invisible"
-  //     }`}
-  //     rel="noopener"
-  //     href={`https://matrix.to/#/${pv.local_user.matrix_user_id}`}
-  //   >
-  //       {i18n.t("send_secure_message")}
-  //   </a>
-  //   );
-  // }
-
   userSettings() {
     return (
       <div>
@@ -797,6 +793,37 @@ export class Person extends Component<any, PersonState> {
               </label>
             </div>
           </div>
+          <div class="form-group">
+            <div class="form-check">
+              <input
+                class="form-check-input"
+                id="user-bot-account"
+                type="checkbox"
+                checked={this.state.saveUserSettingsForm.bot_account}
+                onChange={linkEvent(this, this.handleUserSettingsBotAccount)}
+              />
+              <label class="form-check-label" htmlFor="user-bot-account">
+                {i18n.t("bot_account")}
+              </label>
+            </div>
+          </div>
+          <div class="form-group">
+            <div class="form-check">
+              <input
+                class="form-check-input"
+                id="user-show-bot-accounts"
+                type="checkbox"
+                checked={this.state.saveUserSettingsForm.show_bot_accounts}
+                onChange={linkEvent(
+                  this,
+                  this.handleUserSettingsShowBotAccounts
+                )}
+              />
+              <label class="form-check-label" htmlFor="user-show-bot-accounts">
+                {i18n.t("show_bot_accounts")}
+              </label>
+            </div>
+          </div>
           <div class="form-group">
             <div class="form-check">
               <input
@@ -970,6 +997,16 @@ export class Person extends Component<any, PersonState> {
     i.setState(i.state);
   }
 
+  handleUserSettingsBotAccount(i: Person, event: any) {
+    i.state.saveUserSettingsForm.bot_account = event.target.checked;
+    i.setState(i.state);
+  }
+
+  handleUserSettingsShowBotAccounts(i: Person, event: any) {
+    i.state.saveUserSettingsForm.show_bot_accounts = event.target.checked;
+    i.setState(i.state);
+  }
+
   handleUserSettingsShowScoresChange(i: Person, event: any) {
     i.state.saveUserSettingsForm.show_scores = event.target.checked;
     UserService.Instance.localUserView.local_user.show_scores =
@@ -1148,6 +1185,10 @@ export class Person extends Component<any, PersonState> {
         UserService.Instance.localUserView.person.display_name;
       this.state.saveUserSettingsForm.show_avatars =
         UserService.Instance.localUserView.local_user.show_avatars;
+      this.state.saveUserSettingsForm.bot_account =
+        UserService.Instance.localUserView.person.bot_account;
+      this.state.saveUserSettingsForm.show_bot_accounts =
+        UserService.Instance.localUserView.local_user.show_bot_accounts;
       this.state.saveUserSettingsForm.show_scores =
         UserService.Instance.localUserView.local_user.show_scores;
       this.state.saveUserSettingsForm.email =
diff --git a/yarn.lock b/yarn.lock
index 712c0a6..eba2f02 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5125,10 +5125,10 @@ lcid@^1.0.0:
   dependencies:
     invert-kv "^1.0.0"
 
-lemmy-js-client@0.11.0-rc.10:
-  version "0.11.0-rc.10"
-  resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.11.0-rc.10.tgz#304b5b941a00fe251fb50c81e5ae795e8bf0bd8d"
-  integrity sha512-bVLMnE1xm7mmmUC9gLIQ7wFNZn8HD3nmE56EhNGgqR76zdjZSSk+8ZqBYHUJ2yOikGebzIm0heMFryIsJuqwTg==
+lemmy-js-client@0.11.0-rc.11:
+  version "0.11.0-rc.11"
+  resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.11.0-rc.11.tgz#f99be613d08d0c196a16a37f74fdaa3b196f0459"
+  integrity sha512-IuNzU4+324fhb77JCQ/a/te/gXhQWUvxvtfV3xxQWJ0vG7kWOuz5Rd7KsfSF1d6LbuN9kbO9ebjSRW800ytbsA==
 
 levn@^0.4.1:
   version "0.4.1"