summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-11-27 21:01:12 +0000
committerdakkar <dakkar@thenautilus.net>2024-11-27 21:01:12 +0000
commit3ea85b14a3f55d7f04b0d5c309572a83f2dea562 (patch)
treecaa7595f6dfa37f16cd904c0c514bdd26c6ccdfb /packages/backend/src/server/api
parentmerge: only "publish to followers" when things really change - fixes #733 (!781) (diff)
downloadsharkey-3ea85b14a3f55d7f04b0d5c309572a83f2dea562.tar.gz
sharkey-3ea85b14a3f55d7f04b0d5c309572a83f2dea562.tar.bz2
sharkey-3ea85b14a3f55d7f04b0d5c309572a83f2dea562.zip
silence linter
those objects always have the normal prototype, and can't have `hasOwnProperty` redefined, let me call it normally (otherwise I'd have to write `Object.prototype.hasOwnProperty.call(newUser, field)` and that's ugly)
Diffstat (limited to 'packages/backend/src/server/api')
-rw-r--r--packages/backend/src/server/api/endpoints/i/update.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts
index f0e8dfc832..0965f4bcf4 100644
--- a/packages/backend/src/server/api/endpoints/i/update.ts
+++ b/packages/backend/src/server/api/endpoints/i/update.ts
@@ -588,11 +588,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// `ApRendererService.renderPerson`
private userNeedsPublishing(oldUser: MiLocalUser, newUser: Partial<MiUser>): boolean {
for (const field of ['avatarId', 'bannerId', 'backgroundId', 'isBot', 'username', 'name', 'isLocked', 'isExplorable', 'isCat', 'noindex', 'speakAsCat', 'movedToUri', 'alsoKnownAs'] as (keyof MiUser)[]) {
+ /* eslint-disable-next-line no-prototype-builtins */
if (newUser.hasOwnProperty(field) && oldUser[field] !== newUser[field]) {
return true;
}
}
for (const arrayField of ['emojis', 'tags'] as (keyof MiUser)[]) {
+ /* eslint-disable-next-line no-prototype-builtins */
if (newUser.hasOwnProperty(arrayField) !== oldUser.hasOwnProperty(arrayField)) {
return true;
}
@@ -611,11 +613,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private profileNeedsPublishing(oldProfile: MiUserProfile, newProfile: Partial<MiUserProfile>): boolean {
for (const field of ['description', 'followedMessage', 'birthday', 'location', 'listenbrainz'] as (keyof MiUserProfile)[]) {
+ /* eslint-disable-next-line no-prototype-builtins */
if (newProfile.hasOwnProperty(field) && oldProfile[field] !== newProfile[field]) {
return true;
}
}
for (const arrayField of ['fields'] as (keyof MiUserProfile)[]) {
+ /* eslint-disable-next-line no-prototype-builtins */
if (newProfile.hasOwnProperty(arrayField) !== oldProfile.hasOwnProperty(arrayField)) {
return true;
}