Skip to content

Commit

Permalink
リアクションの統計処理とウォッチ処理を削除
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Feb 23, 2022
1 parent a90974b commit 93bf3ae
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions src/services/note/reaction/create.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import User, { IUser, isLocalUser, isRemoteUser } from '../../../models/user';
import { IUser, isLocalUser, isRemoteUser } from '../../../models/user';
import Note, { INote, pack } from '../../../models/note';
import NoteReaction, { INoteReaction } from '../../../models/note-reaction';
import { publishNoteStream, publishHotStream } from '../../stream';
import { createNotification } from '../../create-notification';
import NoteWatching from '../../../models/note-watching';
import watch from '../watch';
import { renderLike } from '../../../remote/activitypub/renderer/like';
import { deliverToUser, deliverToFollowers } from '../../../remote/activitypub/deliver-manager';
import { renderActivity } from '../../../remote/activitypub/renderer';
import perUserReactionsChart from '../../../services/chart/per-user-reactions';
import { toDbReaction, decodeReaction } from '../../../misc/reaction-lib';
import deleteReaction from './delete';
import { packEmojis } from '../../../misc/pack-emojis';
Expand Down Expand Up @@ -47,8 +44,6 @@ export default async (user: IUser, note: INote, reaction?: string, dislike = fal
}
});

perUserReactionsChart.update(user, note);

incReactionsCount(user);

const decodedReaction = decodeReaction(reaction);
Expand All @@ -75,30 +70,6 @@ export default async (user: IUser, note: INote, reaction?: string, dislike = fal
});
}

// Fetch watchers
NoteWatching
.find({
noteId: note._id,
userId: { $ne: user._id }
}, {
fields: {
userId: true
}
})
.then(watchers => {
for (const watcher of watchers) {
createNotification(watcher.userId, user._id, 'reaction', {
noteId: note._id,
reaction: reaction
});
}
});

// ユーザーがローカルユーザーかつ自動ウォッチ設定がオンならばこの投稿をWatchする
if (isLocalUser(user) && user.settings.autoWatch !== false) {
watch(user._id, note);
}

//#region 配信
if (isLocalUser(user) && !note.localOnly && !user.noFederation) {
const content = renderActivity(await renderLike(inserted, note), user);
Expand Down

0 comments on commit 93bf3ae

Please sign in to comment.