テーブル分割

This commit is contained in:
syuilo 2019-04-10 15:04:27 +09:00
parent 9603f3fa4f
commit 626cfb61ac
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
33 changed files with 267 additions and 232 deletions

View file

@ -17,7 +17,7 @@ import extractMentions from '../../misc/extract-mentions';
import extractEmojis from '../../misc/extract-emojis';
import extractHashtags from '../../misc/extract-hashtags';
import { Note } from '../../models/entities/note';
import { Mutings, Users, NoteWatchings, Followings, Notes, Instances, Polls } from '../../models';
import { Mutings, Users, NoteWatchings, Followings, Notes, Instances, Polls, UserProfiles } from '../../models';
import { DriveFile } from '../../models/entities/drive-file';
import { App } from '../../models/entities/app';
import { Not } from 'typeorm';
@ -256,13 +256,15 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
deliverNoteToMentionedRemoteUsers(mentionedUsers, user, noteActivity);
}
const profile = await UserProfiles.findOne({ userId: user.id });
// If has in reply to note
if (data.reply) {
// Fetch watchers
nmRelatedPromises.push(notifyToWatchersOfReplyee(data.reply, user, nm));
// この投稿をWatchする
if (Users.isLocalUser(user) && user.autoWatch !== false) {
if (Users.isLocalUser(user) && profile.autoWatch) {
watch(user.id, data.reply);
}
@ -286,7 +288,7 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
nmRelatedPromises.push(notifyToWatchersOfRenotee(data.renote, user, nm, type));
// この投稿をWatchする
if (Users.isLocalUser(user) && user.autoWatch !== false) {
if (Users.isLocalUser(user) && profile.autoWatch) {
watch(user.id, data.renote);
}

View file

@ -2,7 +2,7 @@ import watch from '../../../services/note/watch';
import { publishNoteStream } from '../../stream';
import { User } from '../../../models/entities/user';
import { Note } from '../../../models/entities/note';
import { PollVotes, Users, NoteWatchings, Polls } from '../../../models';
import { PollVotes, Users, NoteWatchings, Polls, UserProfiles } from '../../../models';
import { Not } from 'typeorm';
import { genId } from '../../../misc/gen-id';
import { createNotification } from '../../create-notification';
@ -67,8 +67,10 @@ export default (user: User, note: Note, choice: number) => new Promise(async (re
}
});
const profile = await UserProfiles.findOne({ userId: user.id });
// ローカルユーザーが投票した場合この投稿をWatchする
if (Users.isLocalUser(user) && user.autoWatch) {
if (Users.isLocalUser(user) && profile.autoWatch) {
watch(user.id, note);
}
});

View file

@ -8,7 +8,7 @@ import { toDbReaction } from '../../../misc/reaction-lib';
import fetchMeta from '../../../misc/fetch-meta';
import { User } from '../../../models/entities/user';
import { Note } from '../../../models/entities/note';
import { NoteReactions, Users, NoteWatchings, Notes } from '../../../models';
import { NoteReactions, Users, NoteWatchings, Notes, UserProfiles } from '../../../models';
import { Not } from 'typeorm';
import { perUserReactionsChart } from '../../chart';
import { genId } from '../../../misc/gen-id';
@ -79,8 +79,10 @@ export default async (user: User, note: Note, reaction: string) => {
}
});
const profile = await UserProfiles.findOne({ userId: user.id });
// ユーザーがローカルユーザーかつ自動ウォッチ設定がオンならばこの投稿をWatchする
if (Users.isLocalUser(user) && user.autoWatch !== false) {
if (Users.isLocalUser(user) && profile.autoWatch) {
watch(user.id, note);
}