Merge pull request #9147 from annando/Issue-8882

Issue 8882: Fixes permissions of pinned posts
This commit is contained in:
Hypolite Petovan 2020-09-07 03:14:25 -04:00 committed by GitHub
commit b530ef709d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 14 deletions

View file

@ -201,19 +201,7 @@ class Item
return [];
}
if (empty($condition) || !is_array($condition)) {
$condition = ['iid' => $pinned];
} else {
reset($condition);
$first_key = key($condition);
if (!is_int($first_key)) {
$condition['iid'] = $pinned;
} else {
$values_string = substr(str_repeat("?, ", count($pinned)), 0, -2);
$condition[0] = '(' . $condition[0] . ") AND `iid` IN (" . $values_string . ")";
$condition = array_merge($condition, $pinned);
}
}
$condition = DBA::mergeConditions(['iid' => $pinned], $condition);
return self::selectThreadForUser($uid, $selected, $condition, $params);
}