Implement #2983
This commit is contained in:
parent
8ba87443ca
commit
19af2d7a7b
4 changed files with 77 additions and 1 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue