テーブル分割
This commit is contained in:
@@ -15,7 +15,7 @@ import { driveLogger } from './logger';
|
||||
import { IImage, ConvertToJpeg, ConvertToWebp, ConvertToPng } from './image-processor';
|
||||
import { contentDisposition } from '../../misc/content-disposition';
|
||||
import { detectMine } from '../../misc/detect-mine';
|
||||
import { DriveFiles, DriveFolders, Users, Instances } from '../../models';
|
||||
import { DriveFiles, DriveFolders, Users, Instances, UserProfiles } from '../../models';
|
||||
import { InternalStorage } from './internal-storage';
|
||||
import { DriveFile } from '../../models/entities/drive-file';
|
||||
import { IRemoteUser, User } from '../../models/entities/user';
|
||||
@@ -365,6 +365,8 @@ export default async function(
|
||||
propPromises = [calcWh(), calcAvg()];
|
||||
}
|
||||
|
||||
const profile = await UserProfiles.findOne({ userId: user.id });
|
||||
|
||||
const [folder] = await Promise.all([fetchFolder(), Promise.all(propPromises)]);
|
||||
|
||||
let file = new DriveFile();
|
||||
@@ -376,7 +378,7 @@ export default async function(
|
||||
file.comment = comment;
|
||||
file.properties = properties;
|
||||
file.isLink = isLink;
|
||||
file.isSensitive = Users.isLocalUser(user) && user.alwaysMarkNsfw ? true :
|
||||
file.isSensitive = Users.isLocalUser(user) && profile.alwaysMarkNsfw ? true :
|
||||
(sensitive !== null && sensitive !== undefined)
|
||||
? sensitive
|
||||
: false;
|
||||
|
||||
@@ -9,7 +9,7 @@ import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
|
||||
import Logger from '../logger';
|
||||
import { IdentifiableError } from '../../misc/identifiable-error';
|
||||
import { User } from '../../models/entities/user';
|
||||
import { Followings, Users, FollowRequests, Blockings, Instances } from '../../models';
|
||||
import { Followings, Users, FollowRequests, Blockings, Instances, UserProfiles } from '../../models';
|
||||
import { instanceChart, perUserFollowingChart } from '../chart';
|
||||
import { genId } from '../../misc/gen-id';
|
||||
import { createNotification } from '../create-notification';
|
||||
@@ -115,11 +115,13 @@ export default async function(follower: User, followee: User, requestId?: string
|
||||
if (blocked != null) throw new IdentifiableError('3338392a-f764-498d-8855-db939dcf8c48', 'blocked');
|
||||
}
|
||||
|
||||
const followeeProfile = await UserProfiles.findOne({ userId: followee.id });
|
||||
|
||||
// フォロー対象が鍵アカウントである or
|
||||
// フォロワーがBotであり、フォロー対象がBotからのフォローに慎重である or
|
||||
// フォロワーがローカルユーザーであり、フォロー対象がリモートユーザーである
|
||||
// 上記のいずれかに当てはまる場合はすぐフォローせずにフォローリクエストを発行しておく
|
||||
if (followee.isLocked || (followee.carefulBot && follower.isBot) || (Users.isLocalUser(follower) && Users.isRemoteUser(followee))) {
|
||||
if (followee.isLocked || (followeeProfile.carefulBot && follower.isBot) || (Users.isLocalUser(follower) && Users.isRemoteUser(followee))) {
|
||||
let autoAccept = false;
|
||||
|
||||
// 鍵アカウントであっても、既にフォローされていた場合はスルー
|
||||
@@ -132,7 +134,7 @@ export default async function(follower: User, followee: User, requestId?: string
|
||||
}
|
||||
|
||||
// フォローしているユーザーは自動承認オプション
|
||||
if (!autoAccept && (Users.isLocalUser(followee) && followee.autoAcceptFollowed)) {
|
||||
if (!autoAccept && (Users.isLocalUser(followee) && followeeProfile.autoAcceptFollowed)) {
|
||||
const followed = await Followings.findOne({
|
||||
followerId: followee.id,
|
||||
followeeId: follower.id
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user