mirror of
https://github.com/flarum/core.git
synced 2025-10-18 10:16:09 +02:00
Merge branch 'master' into 1236-database-changes
# Conflicts: # src/Forum/Controller/IndexController.php # src/User/UserMetadataUpdater.php
This commit is contained in:
@@ -68,7 +68,7 @@ class EditPostHandler
|
||||
}
|
||||
|
||||
if (isset($attributes['isHidden'])) {
|
||||
$this->assertCan($actor, 'edit', $post);
|
||||
$this->assertCan($actor, 'hide', $post);
|
||||
|
||||
if ($attributes['isHidden']) {
|
||||
$post->hide($actor);
|
||||
|
@@ -166,10 +166,9 @@ class CommentPost extends Post
|
||||
/**
|
||||
* Get the content rendered as HTML.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function getContentHtmlAttribute($value)
|
||||
public function getContentHtmlAttribute()
|
||||
{
|
||||
return static::$formatter->render($this->attributes['content'], $this);
|
||||
}
|
||||
|
@@ -121,9 +121,13 @@ class Post extends AbstractModel
|
||||
|
||||
// Make sure the post's discussion is visible as well
|
||||
$query->whereExists(function ($query) use ($actor) {
|
||||
$grammar = $query->getGrammar();
|
||||
$column1 = $grammar->wrap('discussions.id');
|
||||
$column2 = $grammar->wrap('posts.discussion_id');
|
||||
|
||||
$query->selectRaw('1')
|
||||
->from('discussions')
|
||||
->whereRaw('discussions.id = posts.discussion_id');
|
||||
->whereRaw("$column1 = $column2");
|
||||
|
||||
static::$dispatcher->dispatch(
|
||||
new ScopeModelVisibility(Discussion::query()->setQuery($query), $actor, 'view')
|
||||
|
@@ -79,7 +79,7 @@ class PostPolicy extends AbstractPolicy
|
||||
// Hide hidden posts, unless they are authored by the current user, or
|
||||
// the current user has permission to view hidden posts in the
|
||||
// discussion.
|
||||
if (! $actor->hasPermission('discussion.editPosts')) {
|
||||
if (! $actor->hasPermission('discussion.hidePosts')) {
|
||||
$query->where(function ($query) use ($actor) {
|
||||
$query->whereNull('posts.hidden_at')
|
||||
->orWhere('posts.user_id', $actor->id)
|
||||
@@ -89,7 +89,7 @@ class PostPolicy extends AbstractPolicy
|
||||
->whereRaw('discussions.id = posts.discussion_id')
|
||||
->where(function ($query) use ($actor) {
|
||||
$this->events->dispatch(
|
||||
new ScopeModelVisibility(Discussion::query()->setQuery($query), $actor, 'editPosts')
|
||||
new ScopeModelVisibility(Discussion::query()->setQuery($query), $actor, 'hidePosts')
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user