- if (body.password !== undefined) user.password = body.password
- if (body.nsfwPolicy !== undefined) user.nsfwPolicy = body.nsfwPolicy
- if (body.webTorrentEnabled !== undefined) user.webTorrentEnabled = body.webTorrentEnabled
- if (body.autoPlayVideo !== undefined) user.autoPlayVideo = body.autoPlayVideo
- if (body.autoPlayNextVideo !== undefined) user.autoPlayNextVideo = body.autoPlayNextVideo
- if (body.autoPlayNextVideoPlaylist !== undefined) user.autoPlayNextVideoPlaylist = body.autoPlayNextVideoPlaylist
- if (body.videosHistoryEnabled !== undefined) user.videosHistoryEnabled = body.videosHistoryEnabled
- if (body.videoLanguages !== undefined) user.videoLanguages = body.videoLanguages
- if (body.theme !== undefined) user.theme = body.theme
- if (body.noInstanceConfigWarningModal !== undefined) user.noInstanceConfigWarningModal = body.noInstanceConfigWarningModal
- if (body.noWelcomeModal !== undefined) user.noWelcomeModal = body.noWelcomeModal
+ const keysToUpdate: (keyof UserUpdateMe & keyof AttributesOnly<UserModel>)[] = [
+ 'password',
+ 'nsfwPolicy',
+ 'webTorrentEnabled',
+ 'autoPlayVideo',
+ 'autoPlayNextVideo',
+ 'autoPlayNextVideoPlaylist',
+ 'videosHistoryEnabled',
+ 'videoLanguages',
+ 'theme',
+ 'noInstanceConfigWarningModal',
+ 'noAccountSetupWarningModal',
+ 'noWelcomeModal'
+ ]
+
+ for (const key of keysToUpdate) {
+ if (body[key] !== undefined) user.set(key, body[key])
+ }