Merge pull request #8710 from annando/fix-vid
Handling situations where "vid" is empty
This commit is contained in:
commit
011bbacf43
|
@ -771,7 +771,7 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid)
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
foreach ($parents AS $parent) {
|
foreach ($parents AS $parent) {
|
||||||
$condition = ["`item`.`parent-uri` = ? AND `item`.`uid` IN (0, ?) AND `vid` != ?",
|
$condition = ["`item`.`parent-uri` = ? AND `item`.`uid` IN (0, ?) AND (`vid` != ? OR `vid` IS NULL)",
|
||||||
$parent['uri'], $uid, Verb::getID(Activity::FOLLOW)];
|
$parent['uri'], $uid, Verb::getID(Activity::FOLLOW)];
|
||||||
$items = conversation_fetch_items($parent, $items, $condition, $block_authors, $params);
|
$items = conversation_fetch_items($parent, $items, $condition, $block_authors, $params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ function ping_init(App $a)
|
||||||
|
|
||||||
$notifs = ping_get_notifications(local_user());
|
$notifs = ping_get_notifications(local_user());
|
||||||
|
|
||||||
$condition = ["`unseen` AND `uid` = ? AND `contact-id` != ? AND `vid` != ?",
|
$condition = ["`unseen` AND `uid` = ? AND `contact-id` != ? AND (`vid` != ? OR `vid` IS NULL)",
|
||||||
local_user(), local_user(), Verb::getID(Activity::FOLLOW)];
|
local_user(), local_user(), Verb::getID(Activity::FOLLOW)];
|
||||||
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
|
||||||
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'wall', 'activity'];
|
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'wall', 'activity'];
|
||||||
|
|
|
@ -851,10 +851,10 @@ class PostUpdate
|
||||||
$start_id = $id;
|
$start_id = $id;
|
||||||
$rows = 0;
|
$rows = 0;
|
||||||
|
|
||||||
$items = DBA::p("SELECT `item`.`id`, `item`.`vid`, `item`.`verb` AS `item-verb`, `item-content`.`verb`, `item-activity`.`activity`
|
$items = DBA::p("SELECT `item`.`id`, `item`.`verb` AS `item-verb`, `item-content`.`verb`, `item-activity`.`activity`
|
||||||
FROM `item` LEFT JOIN `item-content` ON `item-content`.`uri-id` = `item`.`uri-id`
|
FROM `item` LEFT JOIN `item-content` ON `item-content`.`uri-id` = `item`.`uri-id`
|
||||||
LEFT JOIN `item-activity` ON `item-activity`.`uri-id` = `item`.`uri-id` AND `item`.`gravity` = ?
|
LEFT JOIN `item-activity` ON `item-activity`.`uri-id` = `item`.`uri-id` AND `item`.`gravity` = ?
|
||||||
WHERE `item`.`id` >= ? ORDER BY `item`.`id` LIMIT 10000", GRAVITY_ACTIVITY, $id);
|
WHERE `item`.`id` >= ? AND `item`.`vid` IS NULL ORDER BY `item`.`id` LIMIT 10000", GRAVITY_ACTIVITY, $id);
|
||||||
|
|
||||||
if (DBA::errorNo() != 0) {
|
if (DBA::errorNo() != 0) {
|
||||||
Logger::error('Database error', ['no' => DBA::errorNo(), 'message' => DBA::errorMessage()]);
|
Logger::error('Database error', ['no' => DBA::errorNo(), 'message' => DBA::errorMessage()]);
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Item
|
||||||
'event-id', 'event-created', 'event-edited', 'event-start', 'event-finish',
|
'event-id', 'event-created', 'event-edited', 'event-start', 'event-finish',
|
||||||
'event-summary', 'event-desc', 'event-location', 'event-type',
|
'event-summary', 'event-desc', 'event-location', 'event-type',
|
||||||
'event-nofinish', 'event-adjust', 'event-ignore', 'event-id',
|
'event-nofinish', 'event-adjust', 'event-ignore', 'event-id',
|
||||||
'delivery_queue_count', 'delivery_queue_done', 'delivery_queue_failed', 'activity'
|
'delivery_queue_count', 'delivery_queue_done', 'delivery_queue_failed'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Field list that is used to deliver items via the protocols
|
// Field list that is used to deliver items via the protocols
|
||||||
|
@ -285,6 +285,10 @@ class Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('vid', $row) && is_null($row['vid']) && !empty($row['verb'])) {
|
||||||
|
$row['vid'] = Verb::getID($row['verb']);
|
||||||
|
}
|
||||||
|
|
||||||
if (!array_key_exists('verb', $row) || in_array($row['verb'], ['', Activity::POST, Activity::SHARE])) {
|
if (!array_key_exists('verb', $row) || in_array($row['verb'], ['', Activity::POST, Activity::SHARE])) {
|
||||||
// Build the file string out of the term entries
|
// Build the file string out of the term entries
|
||||||
if (array_key_exists('file', $row) && empty($row['file'])) {
|
if (array_key_exists('file', $row) && empty($row['file'])) {
|
||||||
|
@ -1802,6 +1806,8 @@ class Item
|
||||||
unset($item[$field]);
|
unset($item[$field]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($item['activity']);
|
||||||
|
|
||||||
// Filling item related side tables
|
// Filling item related side tables
|
||||||
|
|
||||||
// Diaspora signature
|
// Diaspora signature
|
||||||
|
|
Loading…
Reference in New Issue
Block a user