mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-04 01:09:58 -05:00
update: treat non existing permissions as denied
Otherwise, it causes 500 errors.
This commit is contained in:
@@ -34,7 +34,7 @@ class ForumCategoryController extends Controller
|
||||
}
|
||||
|
||||
// Check if the user has permission to view the forum
|
||||
if (!$forum->getPermission()->show_forum) {
|
||||
if (!$forum->getPermission()?->show_forum) {
|
||||
return to_route('forums.index')
|
||||
->withErrors('You Do Not Have Access To This Category!');
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class ForumController extends Controller
|
||||
}
|
||||
|
||||
// Check if the user has permission to view the forum
|
||||
if (!$forum->getPermission()->show_forum) {
|
||||
if (!$forum->getPermission()?->show_forum) {
|
||||
return to_route('forums.index')
|
||||
->withErrors('You Do Not Have Access To This Forum!');
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ class Topic extends Model
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->forum->getPermission()->read_topic;
|
||||
return $this->forum->getPermission()?->read_topic;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
type="checkbox"
|
||||
name="permissions[{{ $group->id }}][show_forum]"
|
||||
value="1"
|
||||
@checked($forum->permissions->where('group_id', '=', $group->id)->first()->show_forum)
|
||||
@checked($forum->permissions->where('group_id', '=', $group->id)->first()?->show_forum)
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
@@ -140,7 +140,7 @@
|
||||
type="checkbox"
|
||||
name="permissions[{{ $group->id }}][read_topic]"
|
||||
value="1"
|
||||
@checked($forum->permissions->where('group_id', '=', $group->id)->first()->read_topic)
|
||||
@checked($forum->permissions->where('group_id', '=', $group->id)->first()?->read_topic)
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
@@ -148,7 +148,7 @@
|
||||
type="checkbox"
|
||||
name="permissions[{{ $group->id }}][start_topic]"
|
||||
value="1"
|
||||
@checked($forum->permissions->where('group_id', '=', $group->id)->first()->start_topic)
|
||||
@checked($forum->permissions->where('group_id', '=', $group->id)->first()?->start_topic)
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
@@ -156,7 +156,7 @@
|
||||
type="checkbox"
|
||||
name="permissions[{{ $group->id }}][reply_topic]"
|
||||
value="1"
|
||||
@checked($forum->permissions->where('group_id', '=', $group->id)->first()->reply_topic)
|
||||
@checked($forum->permissions->where('group_id', '=', $group->id)->first()?->reply_topic)
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</p>
|
||||
@endif
|
||||
|
||||
@if (($topic->state === 'open' && $forum->getPermission()->reply_topic) || auth()->user()->group->is_modo)
|
||||
@if (($topic->state === 'open' && $forum->getPermission()?->reply_topic) || auth()->user()->group->is_modo)
|
||||
<form id="forum_reply_form" method="POST" action="{{ route('posts.store') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="topic_id" value="{{ $topic->id }}" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<header class="panel__header">
|
||||
<h2 class="panel__heading">{{ $forum->description }}</h2>
|
||||
<div class="panel__actions">
|
||||
@if ($forum->getPermission()->start_topic == true)
|
||||
@if ($forum->getPermission()?->start_topic == true)
|
||||
<div class="panel__action">
|
||||
<div class="form__group">
|
||||
<a
|
||||
|
||||
Reference in New Issue
Block a user