Skip to content

Commit eb5c400

Browse files
authored
Merge pull request #1446 from opensource-workshop/bbspost_canedit
[掲示板投稿]返信あり状態での保存判定の修正をしました
2 parents 27b2630 + 058b724 commit eb5c400

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/Models/User/Bbses/BbsPost.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function canEdit()
9090
if (empty($user)) {
9191
return false;
9292
}
93-
if (!$user->can('role_article') && $this->descendants->count() > 0) {
93+
if (!$user->can('role_article') && BbsPost::where(['id' => '!='.$this->id, 'thread_root_id' => $this->id])->count() > 0) {
9494
return false;
9595
}
9696
return true;

app/Plugins/User/Bbses/BbsesPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ public function save($request, $page_id, $frame_id, $post_id = null)
490490
$before_post = clone $post;
491491

492492
// モデレータ以上の権限を持たずに、記事にすでに返信が付いている場合は、保存できない。
493-
if (!$this->isCan('role_article') && $post->descendants->count() > 0) {
493+
if (!$user->can('role_article') && BbsPost::where(['id' => '!='.$this->id, 'thread_root_id' => $this->id])->count() > 0) {
494494
$validator = Validator::make($request->all(), []);
495495
$validator->errors()->add('reply_role_error', '返信のある記事の編集はできません。');
496496
return back()->withErrors($validator)->withInput();

0 commit comments

Comments
 (0)