This commit is contained in:
@@ -51,6 +51,11 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re
|
||||
if (isBotErr) return rej('invalid is_bot param');
|
||||
if (isBot != null) user.is_bot = isBot;
|
||||
|
||||
// Get 'auto_watch' parameter
|
||||
const [autoWatch, autoWatchErr] = $(params.auto_watch).optional.boolean().$;
|
||||
if (autoWatchErr) return rej('invalid auto_watch param');
|
||||
if (autoWatch != null) user.settings.auto_watch = autoWatch;
|
||||
|
||||
await User.update(user._id, {
|
||||
$set: {
|
||||
name: user.name,
|
||||
@@ -58,7 +63,8 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re
|
||||
avatar_id: user.avatar_id,
|
||||
banner_id: user.banner_id,
|
||||
profile: user.profile,
|
||||
is_bot: user.is_bot
|
||||
is_bot: user.is_bot,
|
||||
settings: user.settings
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -377,9 +377,9 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
|
||||
});
|
||||
|
||||
// この投稿をWatchする
|
||||
// TODO: ユーザーが「返信したときに自動でWatchする」設定を
|
||||
// オフにしていた場合はしない
|
||||
watch(user._id, reply);
|
||||
if (user.settings.auto_watch !== false) {
|
||||
watch(user._id, reply);
|
||||
}
|
||||
|
||||
// Add mention
|
||||
addMention(reply.user_id, 'reply');
|
||||
|
@@ -100,9 +100,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
});
|
||||
|
||||
// この投稿をWatchする
|
||||
// TODO: ユーザーが「投票したときに自動でWatchする」設定を
|
||||
// オフにしていた場合はしない
|
||||
watch(user._id, post);
|
||||
if (user.settings.auto_watch !== false) {
|
||||
watch(user._id, post);
|
||||
}
|
||||
});
|
||||
|
||||
function findWithAttr(array, attr, value) {
|
||||
|
@@ -116,7 +116,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
});
|
||||
|
||||
// この投稿をWatchする
|
||||
// TODO: ユーザーが「リアクションしたときに自動でWatchする」設定を
|
||||
// オフにしていた場合はしない
|
||||
watch(user._id, post);
|
||||
if (user.settings.auto_watch !== false) {
|
||||
watch(user._id, post);
|
||||
}
|
||||
});
|
||||
|
@@ -81,6 +81,8 @@ export type IUser = {
|
||||
keywords: string[];
|
||||
two_factor_secret: string;
|
||||
two_factor_enabled: boolean;
|
||||
client_settings: any;
|
||||
settings: any;
|
||||
};
|
||||
|
||||
export function init(user): IUser {
|
||||
|
@@ -132,7 +132,9 @@ export default async (req: express.Request, res: express.Response) => {
|
||||
location: null,
|
||||
weight: null
|
||||
},
|
||||
settings: {},
|
||||
settings: {
|
||||
auto_watch: true
|
||||
},
|
||||
client_settings: {
|
||||
home: homeData,
|
||||
show_donation: false
|
||||
|
Reference in New Issue
Block a user