Forums and categories: mark read if underlying topics are read.

このコミットが含まれているのは:
テクニカル諏訪子 2018-04-26 17:59:08 +09:00
コミット 83d3a646a6
1個のファイルの変更15行の追加12行の削除

ファイルの表示

@ -53,7 +53,6 @@ class BoardController extends Controller {
$valid = $this->objAuth->getPermissions($username, $password);
if ($valid['for_canview']) {
$res = array();
$isRead = array();
if ($for != 0) {
@ -69,10 +68,19 @@ class BoardController extends Controller {
foreach ($isRead as $r) {
$yetToRead = false;
$rid = 0;
if ($for != 0) {
$rid = $r->id;
}
else {
$rid = $r['id'];
}
$get = DB::table('for_read')
->join('for_posts', 'for_posts.top_id', 'for_read.top_id')
->where('for_read.user_id', $check)
->where('for_read.top_id', $r['id'])
->where('for_read.top_id', $rid)
->get(array(
'for_posts.id',
'for_posts.user_id',
@ -83,10 +91,6 @@ class BoardController extends Controller {
if (!$get->count()) {
$yetToRead = true;
$res[] = array(
'top_id' => $r['id'],
'read' => true
);
}
else {
foreach($get as $g) {
@ -96,11 +100,6 @@ class BoardController extends Controller {
else {
$yetToRead = false;
}
$res[] = array(
'top_id' => $g->top_id,
'read' => $yetToRead
);
}
}
}
@ -1297,6 +1296,7 @@ class BoardController extends Controller {
$resF = array();
foreach($fors as $f) {
$read = $this->checkRead($f['id'], 0, $request->username, $request->password);
$ldet = $this->getLastPostOfForum($f['id']);
$topicsuu = DB::table('for_threads')->where('for_id', $f['id'])->count();
$replysuu = $this->countPostsInForum($f['id']);
@ -1344,7 +1344,8 @@ class BoardController extends Controller {
'f_desc' => $f['description'],
'f_topics' => $topicsuu,
'f_posts' => $replysuu,
'f_last' => $ldet['date']
'f_last' => $ldet['date'],
'f_read' => $read
);
}
@ -1367,6 +1368,7 @@ class BoardController extends Controller {
$res = array();
foreach($fors as $f) {
$read = $this->checkRead($f['id'], 0, $request->username, $request->password);
$ldet = $this->getLastPostOfForum($f['id']);
$topicsuu = DB::table('for_threads')->where('for_id', $f['id'])->count();
$replysuu = $this->countPostsInForum($f['id']);
@ -1414,6 +1416,7 @@ class BoardController extends Controller {
'f_topics' => $topicsuu,
'f_posts' => $replysuu,
'f_last' => $ldet['date'],
'f_read' => $read,
'c_name' => $catname[0]->title,
'u_name' => $showName,
'u_col' => $showCol