diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-11-01 04:28:53 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-11-01 04:28:53 +0900 |
| commit | c5d5f7cef39eec27db34ac9ff2cb6db25bbab206 (patch) | |
| tree | 9f2e68111a45c2729568611dba1a61c2a6e5dbbf /src/api/endpoints | |
| parent | Merge pull request #854 from syuilo/bbs (diff) | |
| download | sharkey-c5d5f7cef39eec27db34ac9ff2cb6db25bbab206.tar.gz sharkey-c5d5f7cef39eec27db34ac9ff2cb6db25bbab206.tar.bz2 sharkey-c5d5f7cef39eec27db34ac9ff2cb6db25bbab206.zip | |
Fix bug
Diffstat (limited to 'src/api/endpoints')
| -rw-r--r-- | src/api/endpoints/posts/create.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts index 34265dcbc3..2e9f1d90fb 100644 --- a/src/api/endpoints/posts/create.ts +++ b/src/api/endpoints/posts/create.ts @@ -228,11 +228,13 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { // ----------------------------------------------------------- // Post processes - Channel.update({ _id: channel._id }, { - $inc: { - index: 1 - } - }); + if (channel) { + Channel.update({ _id: channel._id }, { + $inc: { + index: 1 + } + }); + } User.update({ _id: user._id }, { $set: { |