]> Untitled Git - lemmy-ui.git/commitdiff
Adding bot acct settings. Fixes #242
authorDessalines <tyhou13@gmx.com>
Sat, 24 Apr 2021 00:08:38 +0000 (20:08 -0400)
committerDessalines <tyhou13@gmx.com>
Sat, 24 Apr 2021 03:19:59 +0000 (23:19 -0400)
lemmy-translations
package.json
src/shared/components/person.tsx
yarn.lock

index 12e8d61e9ba2620b0031e237d87367480452b6fb..ef6c991e345a880d98b165508f28793fef3f922a 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 12e8d61e9ba2620b0031e237d87367480452b6fb
+Subproject commit ef6c991e345a880d98b165508f28793fef3f922a
index 7cc904da46d1aa432dd09f5595512c10b2f424f8..0153a9287b3ce38abf77676e3db53304be0f45c1 100644 (file)
@@ -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",
index a38a36eca3d5a09b5c851facf1a46f99696ecbbd..c0ef9f0da1e747dc40ec744d5f1289981343c3c1 100644 (file)
@@ -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 =
index 712c0a6b1b56daabc7fe7f32aff4f1705c8de368..eba2f0232cc108588c051d3beecdff99e3124681 100644 (file)
--- 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"