summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-11-01 04:28:53 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-11-01 04:28:53 +0900
commitc5d5f7cef39eec27db34ac9ff2cb6db25bbab206 (patch)
tree9f2e68111a45c2729568611dba1a61c2a6e5dbbf
parentMerge pull request #854 from syuilo/bbs (diff)
downloadsharkey-c5d5f7cef39eec27db34ac9ff2cb6db25bbab206.tar.gz
sharkey-c5d5f7cef39eec27db34ac9ff2cb6db25bbab206.tar.bz2
sharkey-c5d5f7cef39eec27db34ac9ff2cb6db25bbab206.zip
Fix bug
-rw-r--r--src/api/endpoints/posts/create.ts12
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: {