From f75c2cfc9cdbb52dc1bf9de64f9afc70e60f7057 Mon Sep 17 00:00:00 2001 From: David Sevilla Martin Date: Sat, 1 Feb 2020 09:05:16 -0500 Subject: [PATCH] forum: do not update lastSeenAt when modifying discloseOnline preference This value is immediately set in the backend again, so apart from causing visual glitches, it is useless as the preference doesn't prevent admins from seeing your last seen at time --- js/src/common/components/LinkButton.tsx | 4 ++-- js/src/common/models/User.ts | 2 +- js/src/forum/components/SettingsPage.tsx | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/js/src/common/components/LinkButton.tsx b/js/src/common/components/LinkButton.tsx index e4cdc02e8..e220caaa9 100644 --- a/js/src/common/components/LinkButton.tsx +++ b/js/src/common/components/LinkButton.tsx @@ -1,8 +1,8 @@ import Button, { ButtonProps } from './Button'; interface LinkButtonProps extends ButtonProps { - active: boolean; - oncreate: Function; + active?: boolean; + oncreate?: Function; href?: string; } diff --git a/js/src/common/models/User.ts b/js/src/common/models/User.ts index 302f0dd3a..8b548db90 100644 --- a/js/src/common/models/User.ts +++ b/js/src/common/models/User.ts @@ -101,7 +101,7 @@ export default class User extends Model { /** * Update the user's preferences. */ - savePreferences(newPreferences: object): Promise { + savePreferences(newPreferences: UserPreferences): Promise { const preferences = this.preferences(); Object.assign(preferences, newPreferences); diff --git a/js/src/forum/components/SettingsPage.tsx b/js/src/forum/components/SettingsPage.tsx index 159e7dbf1..fdda0b95e 100644 --- a/js/src/forum/components/SettingsPage.tsx +++ b/js/src/forum/components/SettingsPage.tsx @@ -122,10 +122,7 @@ export default class SettingsPage extends UserPage { Switch.component({ children: app.translator.trans('core.forum.settings.privacy_disclose_online_label'), state: this.user.preferences().discloseOnline, - onchange: (value, component) => { - this.user.pushAttributes({ lastSeenAt: null }); - this.preferenceSaver('discloseOnline')(value, component); - }, + onchange: (value, component) => this.preferenceSaver('discloseOnline')(value, component), }) );