diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-09-25 21:09:38 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-09-25 21:09:38 +0900 |
| commit | afdacf14b7d114e542dbed60c029948b2ea5910d (patch) | |
| tree | d9a4c066f5f72ca4597b54e5baa0ed945fe4599c /src/server/api/endpoints/drive/files | |
| parent | Fix #2766 (diff) | |
| download | sharkey-afdacf14b7d114e542dbed60c029948b2ea5910d.tar.gz sharkey-afdacf14b7d114e542dbed60c029948b2ea5910d.tar.bz2 sharkey-afdacf14b7d114e542dbed60c029948b2ea5910d.zip | |
Add excludeNsfw option
Diffstat (limited to 'src/server/api/endpoints/drive/files')
| -rw-r--r-- | src/server/api/endpoints/drive/files/update.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/server/api/endpoints/drive/files/update.ts b/src/server/api/endpoints/drive/files/update.ts index ba9abfec61..3c7932c341 100644 --- a/src/server/api/endpoints/drive/files/update.ts +++ b/src/server/api/endpoints/drive/files/update.ts @@ -4,6 +4,7 @@ import DriveFile, { validateFileName, pack } from '../../../../../models/drive-f import { publishDriveStream } from '../../../../../stream'; import { ILocalUser } from '../../../../../models/user'; import getParams from '../../../get-params'; +import Note from '../../../../../models/note'; export const meta = { desc: { @@ -93,6 +94,18 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) = } }); + // ドライブのファイルが非正規化されているドキュメントも更新 + Note.find({ + '_files._id': file._id + }).then(notes => { + notes.forEach(note => { + note._files[note._files.findIndex(f => f._id.equals(file._id))] = file; + Note.findOneAndUpdate({ _id: note._id }, { + _files: note._files + }); + }); + }); + // Serialize const fileObj = await pack(file); |