Don't create a user-item entry on default
This commit is contained in:
parent
1193b73125
commit
4002bd9b97
|
@ -321,7 +321,9 @@ class Item
|
|||
|
||||
$items = Post::select(['id', 'uid', 'uri-id'], $condition);
|
||||
while ($item = Post::fetch($items)) {
|
||||
Post\User::update($item['uri-id'], $item['uid'], ['hidden' => true]);
|
||||
if (in_array($item['uid'], [$uid, 0])) {
|
||||
Post\User::update($item['uri-id'], $uid, ['hidden' => true], true);
|
||||
}
|
||||
|
||||
// "Deleting" global items just means hiding them
|
||||
if ($item['uid'] == 0) {
|
||||
|
|
|
@ -66,11 +66,12 @@ class User
|
|||
*
|
||||
* @param integer $uri_id
|
||||
* @param integer $uid
|
||||
* @param array $fields
|
||||
* @param array $data
|
||||
* @param bool $insert_if_missing
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function update(int $uri_id, int $uid, array $data = [])
|
||||
public static function update(int $uri_id, int $uid, array $data = [], bool $insert_if_missing = false)
|
||||
{
|
||||
if (empty($uri_id)) {
|
||||
throw new BadMethodCallException('Empty URI_id');
|
||||
|
@ -86,6 +87,6 @@ class User
|
|||
return true;
|
||||
}
|
||||
|
||||
return DBA::update('post-user', $fields, ['uri-id' => $uri_id, 'uid' => $uid], true);
|
||||
return DBA::update('post-user', $fields, ['uri-id' => $uri_id, 'uid' => $uid], $insert_if_missing ? true : []);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue