1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-29 15:28:31 +09:00
This commit is contained in:
syuilo 2018-03-05 08:07:09 +09:00
parent 5daa9262f6
commit cb0d237b6a
7 changed files with 38 additions and 11 deletions

View File

@ -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
}
});

View File

@ -377,9 +377,9 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
});
// この投稿をWatchする
// TODO: ユーザーが「返信したときに自動でWatchする」設定を
// オフにしていた場合はしない
if (user.settings.auto_watch !== false) {
watch(user._id, reply);
}
// Add mention
addMention(reply.user_id, 'reply');

View File

@ -100,9 +100,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
});
// この投稿をWatchする
// TODO: ユーザーが「投票したときに自動でWatchする」設定を
// オフにしていた場合はしない
if (user.settings.auto_watch !== false) {
watch(user._id, post);
}
});
function findWithAttr(array, attr, value) {

View File

@ -116,7 +116,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
});
// この投稿をWatchする
// TODO: ユーザーが「リアクションしたときに自動でWatchする」設定を
// オフにしていた場合はしない
if (user.settings.auto_watch !== false) {
watch(user._id, post);
}
});

View File

@ -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 {

View File

@ -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

View File

@ -62,6 +62,13 @@
</div>
</section>
<section class="notification" v-show="page == 'notification'">
<h1>通知</h1>
<mk-switch v-model="autoWatch" @change="onChangeAutoWatch" text="投稿の自動ウォッチ">
<span>リアクションしたり返信したりした投稿に関する通知を自動的に受け取るようにします</span>
</mk-switch>
</section>
<section class="drive" v-show="page == 'drive'">
<h1>%i18n:desktop.tags.mk-settings.drive%</h1>
<mk-drive-setting/>
@ -173,6 +180,7 @@ export default Vue.extend({
version,
latestVersion: undefined,
checkingForUpdate: false,
autoWatch: true,
enableSounds: localStorage.getItem('enableSounds') == 'true',
lang: localStorage.getItem('lang') || '',
preventUpdate: localStorage.getItem('preventUpdate') == 'true',
@ -206,12 +214,21 @@ export default Vue.extend({
(this as any).os.getMeta().then(meta => {
this.meta = meta;
});
if ((this as any).os.i.settings.auto_watch != null) {
this.autoWatch = (this as any).os.i.settings.auto_watch;
}
},
methods: {
customizeHome() {
this.$router.push('/i/customize-home');
this.$emit('done');
},
onChangeAutoWatch(v) {
(this as any).api('i/update', {
auto_watch: v
});
},
onChangeShowPostFormOnTopOfTl(v) {
(this as any).api('i/update_client_setting', {
name: 'showPostFormOnTopOfTl',