summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/notes
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-17 22:31:52 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-17 22:31:52 +0900
commit50d56bdc2585a3bbd4ad996426f62d6ed186a34d (patch)
treee87f3b189f384e6ac5592e223350c67d6b2be6e8 /src/server/api/endpoints/notes
parent良い感じに (diff)
downloadsharkey-50d56bdc2585a3bbd4ad996426f62d6ed186a34d.tar.gz
sharkey-50d56bdc2585a3bbd4ad996426f62d6ed186a34d.tar.bz2
sharkey-50d56bdc2585a3bbd4ad996426f62d6ed186a34d.zip
Clean up
Diffstat (limited to 'src/server/api/endpoints/notes')
-rw-r--r--src/server/api/endpoints/notes/create.ts42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/server/api/endpoints/notes/create.ts b/src/server/api/endpoints/notes/create.ts
index 7e79912b1b..4435a6a3c8 100644
--- a/src/server/api/endpoints/notes/create.ts
+++ b/src/server/api/endpoints/notes/create.ts
@@ -97,31 +97,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
return rej('cannot renote to renote');
}
- // Fetch recently note
- const latestNote = await Note.findOne({
- userId: user._id
- }, {
- sort: {
- _id: -1
- }
- });
-
isQuote = text != null || files != null;
-
- // 直近と同じRenote対象かつ引用じゃなかったらエラー
- if (latestNote &&
- latestNote.renoteId &&
- latestNote.renoteId.equals(renote._id) &&
- !isQuote) {
- return rej('cannot renote same note that already reposted in your latest note');
- }
-
- // 直近がRenote対象かつ引用じゃなかったらエラー
- if (latestNote &&
- latestNote._id.equals(renote._id) &&
- !isQuote) {
- return rej('cannot renote your latest note');
- }
}
// Get 'replyId' parameter
@@ -208,24 +184,6 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
return rej('text, mediaIds, renoteId or poll is required');
}
- // 直近の投稿と重複してたらエラー
- // TODO: 直近の投稿が一日前くらいなら重複とは見なさない
- if (user.latestNote) {
- if (deepEqual({
- text: user.latestNote.text,
- reply: user.latestNote.replyId ? user.latestNote.replyId.toString() : null,
- renote: user.latestNote.renoteId ? user.latestNote.renoteId.toString() : null,
- mediaIds: (user.latestNote.mediaIds || []).map(id => id.toString())
- }, {
- text: text,
- reply: reply ? reply._id.toString() : null,
- renote: renote ? renote._id.toString() : null,
- mediaIds: (files || []).map(file => file._id.toString())
- })) {
- return rej('duplicate');
- }
- }
-
// 投稿を作成
const note = await create(user, {
createdAt: new Date(),