Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit 5eca3aa

Browse files
Merge branch 'release/1.0.0'
2 parents a83d212 + 395af79 commit 5eca3aa

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Changelog
22

3+
## 1.0.0 (April 13, 2016)
4+
5+
### Fixed
6+
- Add roles check to feed action
7+
38
## 0.11.2 (April 7, 2016)
49

5-
### FIXED
10+
### Fixed
611
- Fixed update URL after comment
712
- Fixed different prefixes with SQLLite
813
- Fixed SQLite collations

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "pagekit/blog",
33
"type": "pagekit-extension",
4-
"version": "0.11.2",
4+
"version": "1.0.0",
55
"title": "Blog",
66
"description": "A blog extensions with a built-in comment system.",
77
"license": "MIT",

src/Controller/SiteController.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ public function feedAction($type = '')
9595
$feed->setDate($last->modified);
9696
}
9797

98-
foreach (Post::where(['status = ?', 'date < ?'], [Post::STATUS_PUBLISHED, new \DateTime])->related('user')->limit($this->blog->config('feed.limit'))->orderBy('date', 'DESC')->get() as $post) {
98+
foreach (Post::where(['status = ?', 'date < ?'], [Post::STATUS_PUBLISHED, new \DateTime])->where(function ($query) {
99+
return $query->where('roles IS NULL')->whereInSet('roles', App::user()->roles, false, 'OR');
100+
})->related('user')->limit($this->blog->config('feed.limit'))->orderBy('date', 'DESC')->get() as $post) {
99101
$url = App::url('@blog/id', ['id' => $post->id], 0);
100102
$feed->addItem(
101103
$feed->createItem([

src/Model/PostModelTrait.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ public static function updateCommentInfo($id)
1818
{
1919
$query = Comment::where(['post_id' => $id, 'status' => Comment::STATUS_APPROVED]);
2020

21-
self::where(compact('id'))->update([
22-
'comment_count' => $query->count()
23-
]
24-
);
21+
self::where(compact('id'))->update(['comment_count' => $query->count()]);
2522
}
2623

2724
/**

0 commit comments

Comments
 (0)