Merge pull request #273 from LemmyNet/feature/bot_accounts

Adding bot acct settings. Fixes #242
This commit is contained in:
Dessalines 2021-04-23 23:22:05 -04:00 committed by GitHub
commit 017121d0fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 27 deletions

@ -1 +1 @@
Subproject commit 12e8d61e9ba2620b0031e237d87367480452b6fb Subproject commit ef6c991e345a880d98b165508f28793fef3f922a

View File

@ -68,7 +68,7 @@
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"husky": "^6.0.0", "husky": "^6.0.0",
"iso-639-1": "^2.1.9", "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", "lint-staged": "^10.5.4",
"mini-css-extract-plugin": "^1.4.1", "mini-css-extract-plugin": "^1.4.1",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",

View File

@ -439,12 +439,23 @@ export class Person extends Component<any, PersonState> {
{i18n.t("logout")} {i18n.t("logout")}
</button> </button>
) : ( ) : (
<>
<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 <Link
className={"d-flex align-self-start btn btn-secondary"} className={"d-flex align-self-start btn btn-secondary"}
to={`/create_private_message/recipient/${pv.person.id}`} to={`/create_private_message/recipient/${pv.person.id}`}
> >
{i18n.t("send_message")} {i18n.t("send_message")}
</Link> </Link>
</>
)} )}
</div> </div>
{pv.person.bio && ( {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() { userSettings() {
return ( return (
<div> <div>
@ -797,6 +793,37 @@ export class Person extends Component<any, PersonState> {
</label> </label>
</div> </div>
</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-group">
<div class="form-check"> <div class="form-check">
<input <input
@ -970,6 +997,16 @@ export class Person extends Component<any, PersonState> {
i.setState(i.state); 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) { handleUserSettingsShowScoresChange(i: Person, event: any) {
i.state.saveUserSettingsForm.show_scores = event.target.checked; i.state.saveUserSettingsForm.show_scores = event.target.checked;
UserService.Instance.localUserView.local_user.show_scores = UserService.Instance.localUserView.local_user.show_scores =
@ -1148,6 +1185,10 @@ export class Person extends Component<any, PersonState> {
UserService.Instance.localUserView.person.display_name; UserService.Instance.localUserView.person.display_name;
this.state.saveUserSettingsForm.show_avatars = this.state.saveUserSettingsForm.show_avatars =
UserService.Instance.localUserView.local_user.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 = this.state.saveUserSettingsForm.show_scores =
UserService.Instance.localUserView.local_user.show_scores; UserService.Instance.localUserView.local_user.show_scores;
this.state.saveUserSettingsForm.email = this.state.saveUserSettingsForm.email =

View File

@ -5125,10 +5125,10 @@ lcid@^1.0.0:
dependencies: dependencies:
invert-kv "^1.0.0" invert-kv "^1.0.0"
lemmy-js-client@0.11.0-rc.10: lemmy-js-client@0.11.0-rc.11:
version "0.11.0-rc.10" version "0.11.0-rc.11"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.11.0-rc.10.tgz#304b5b941a00fe251fb50c81e5ae795e8bf0bd8d" resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.11.0-rc.11.tgz#f99be613d08d0c196a16a37f74fdaa3b196f0459"
integrity sha512-bVLMnE1xm7mmmUC9gLIQ7wFNZn8HD3nmE56EhNGgqR76zdjZSSk+8ZqBYHUJ2yOikGebzIm0heMFryIsJuqwTg== integrity sha512-IuNzU4+324fhb77JCQ/a/te/gXhQWUvxvtfV3xxQWJ0vG7kWOuz5Rd7KsfSF1d6LbuN9kbO9ebjSRW800ytbsA==
levn@^0.4.1: levn@^0.4.1:
version "0.4.1" version "0.4.1"