This commit is contained in:
syuilo 2018-10-23 07:04:00 +09:00
parent 8ba87443ca
commit 19af2d7a7b
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
4 changed files with 77 additions and 1 deletions

View file

@ -11,6 +11,7 @@ import perUserNotesChart from '../../chart/per-user-notes';
import config from '../../config';
import NoteUnread from '../../models/note-unread';
import read from './read';
import DriveFile from '../../models/drive-file';
/**
* 稿
@ -48,6 +49,17 @@ export default async function(user: IUser, note: INote) {
});
});
// ファイルが添付されていた場合ドライブのファイルの「このファイルが添付された投稿一覧」プロパティからこの投稿を削除
if (note.fileIds) {
note.fileIds.forEach(fileId => {
DriveFile.update({ _id: fileId }, {
$pull: {
'metadata.attachedNoteIds': note._id
}
});
});
}
//#region ローカルの投稿なら削除アクティビティを配送
if (isLocalUser(user)) {
const content = pack(renderDelete(renderTombstone(`${config.url}/notes/${note._id}`), user));