Browse Source

user: add inbox control and 24hr account requirement to send

Let users disable their inbox as a setting and also ban new accounts from sending a pm for 24hrs
main
eday 1 year ago
parent
commit
93508f0d72
  1. 22
      src/components/user.tsx
  2. 2
      src/interfaces.ts
  3. 3
      translations/en.json

22
src/components/user.tsx

@ -137,6 +137,7 @@ class BaseUser extends Component<any, UserState> {
has_2fa: null,
actor_id: null,
local: null,
inbox_disabled: null,
},
user_id: null,
username: null,
@ -157,6 +158,7 @@ class BaseUser extends Component<any, UserState> {
send_notifications_to_email: null,
has_2fa: null,
auth: null,
inbox_disabled: null,
},
userSettingsLoading: null,
deleteAccountLoading: null,
@ -969,6 +971,17 @@ class BaseUser extends Component<any, UserState> {
{i18n.t('send_notifications_to_email')}
</Label>
</div>
<div className="form-group">
<Label>
<Checkbox
id="user-inbox-disabled"
type="checkbox"
checked={this.state.userSettingsForm.inbox_disabled}
onChange={linkEvent(this, this.handleUserSettingsInboxChange)}
/>
{i18n.t('disable_inbox')}
</Label>
</div>
<div className="form-group">
<Button
type="submit"
@ -1283,6 +1296,15 @@ class BaseUser extends Component<any, UserState> {
i.setState(i.state);
}
handleUserSettingsInboxChange(i: BaseUser, event: any) {
i.setState({
userSettingsForm: {
...i.state.userSettingsForm,
inbox_disabled: event.target.checked,
},
});
}
handleUserSettingsThemeChange = (value: string) => {
changeTheme(value);
this.setState({

2
src/interfaces.ts

@ -188,6 +188,7 @@ export interface UserView {
show_avatars: boolean;
send_notifications_to_email: boolean;
has_2fa: boolean;
inbox_disabled: boolean;
}
export interface CommunityUser {
@ -694,6 +695,7 @@ export interface UserSettingsForm {
send_notifications_to_email: boolean;
has_2fa: boolean;
auth: string;
inbox_disabled: boolean;
}
export interface CommunityForm {

3
translations/en.json

@ -310,5 +310,6 @@
"enter_code": "Enter Code",
"report": "report",
"remove_user_content": "Remove User Content",
"submit": "Submit"
"submit": "Submit",
"disable_inbox": "Disable Inbox"
}
Loading…
Cancel
Save