Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/1.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
florianpircher committed Aug 11, 2017
2 parents 8a5197c + 4c76fd6 commit 9cfb9c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion blueprints/comment.yml
Expand Up @@ -28,7 +28,7 @@ fields:
validate:
email

url:
website:
label: Website Address
type: url
width: 1/2
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -3,7 +3,7 @@
"description": "File-based comments stored as subpages for the Kirby CMS.",
"author": "Florian Pircher <florian@addpixel.net>",
"license": "MIT",
"version": "1.4.1",
"version": "1.4.2",
"type": "kirby-plugin",
"repository": {
"type": "git",
Expand Down
6 changes: 4 additions & 2 deletions plugin/Comments.php
Expand Up @@ -214,7 +214,7 @@ public function process()
$comments_page = $this->page->find($comments_page_dirname);

$now = new DateTime();
$new_comment_id = count($this->comments) + 1;
$new_comment_id = $this->nextCommentId();
$new_comment = null;

try {
Expand Down Expand Up @@ -326,7 +326,9 @@ public function nextCommentId()
$stored_comments = array_filter($this->comments, function ($x) {
return $x->isPreview() === false;
});
return count($stored_comments) + 1;
return count($stored_comments) === 0
? 1
: $stored_comments[count($stored_comments) - 1]->id() + 1;
}

public function userHasSubmitted()
Expand Down

0 comments on commit 9cfb9c1

Please sign in to comment.