"post-reason" ends double usage of "post-type"
This commit is contained in:
parent
9a3a7793f0
commit
688e056ad1
13 changed files with 159 additions and 76 deletions
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 2021.03-rc (Red Hot Poker)
|
-- Friendica 2021.03-rc (Red Hot Poker)
|
||||||
-- DB_UPDATE_VERSION 1412
|
-- DB_UPDATE_VERSION 1413
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -934,7 +934,7 @@ CREATE TABLE IF NOT EXISTS `post` (
|
||||||
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
|
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
|
||||||
`author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
|
`author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
|
||||||
`causer-id` int unsigned COMMENT 'Link to the contact table with uid=0 of the contact that caused the item creation',
|
`causer-id` int unsigned COMMENT 'Link to the contact table with uid=0 of the contact that caused the item creation',
|
||||||
`post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
|
`post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, image, article, ...)',
|
||||||
`vid` smallint unsigned COMMENT 'Id of the verb table entry that contains the activity verbs',
|
`vid` smallint unsigned COMMENT 'Id of the verb table entry that contains the activity verbs',
|
||||||
`private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
|
`private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
|
||||||
`global` boolean NOT NULL DEFAULT '0' COMMENT '',
|
`global` boolean NOT NULL DEFAULT '0' COMMENT '',
|
||||||
|
@ -1100,7 +1100,8 @@ CREATE TABLE IF NOT EXISTS `post-user` (
|
||||||
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
|
`owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
|
||||||
`author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
|
`author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
|
||||||
`causer-id` int unsigned COMMENT 'Link to the contact table with uid=0 of the contact that caused the item creation',
|
`causer-id` int unsigned COMMENT 'Link to the contact table with uid=0 of the contact that caused the item creation',
|
||||||
`post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
|
`post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, image, article, ...)',
|
||||||
|
`post-reason` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Reason why the post arrived at the user',
|
||||||
`vid` smallint unsigned COMMENT 'Id of the verb table entry that contains the activity verbs',
|
`vid` smallint unsigned COMMENT 'Id of the verb table entry that contains the activity verbs',
|
||||||
`private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
|
`private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
|
||||||
`global` boolean NOT NULL DEFAULT '0' COMMENT '',
|
`global` boolean NOT NULL DEFAULT '0' COMMENT '',
|
||||||
|
@ -1488,6 +1489,7 @@ CREATE VIEW `post-user-view` AS SELECT
|
||||||
`post-user`.`received` AS `received`,
|
`post-user`.`received` AS `received`,
|
||||||
`post-thread-user`.`changed` AS `changed`,
|
`post-thread-user`.`changed` AS `changed`,
|
||||||
`post-user`.`post-type` AS `post-type`,
|
`post-user`.`post-type` AS `post-type`,
|
||||||
|
`post-user`.`post-reason` AS `post-reason`,
|
||||||
`post-user`.`private` AS `private`,
|
`post-user`.`private` AS `private`,
|
||||||
`post-thread-user`.`pubmail` AS `pubmail`,
|
`post-thread-user`.`pubmail` AS `pubmail`,
|
||||||
`post-user`.`visible` AS `visible`,
|
`post-user`.`visible` AS `visible`,
|
||||||
|
@ -1647,6 +1649,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
||||||
`post-thread-user`.`received` AS `received`,
|
`post-thread-user`.`received` AS `received`,
|
||||||
`post-thread-user`.`changed` AS `changed`,
|
`post-thread-user`.`changed` AS `changed`,
|
||||||
`post-user`.`post-type` AS `post-type`,
|
`post-user`.`post-type` AS `post-type`,
|
||||||
|
`post-user`.`post-reason` AS `post-reason`,
|
||||||
`post-user`.`private` AS `private`,
|
`post-user`.`private` AS `private`,
|
||||||
`post-thread-user`.`pubmail` AS `pubmail`,
|
`post-thread-user`.`pubmail` AS `pubmail`,
|
||||||
`post-thread-user`.`ignored` AS `ignored`,
|
`post-thread-user`.`ignored` AS `ignored`,
|
||||||
|
|
|
@ -725,7 +725,7 @@ function conversation_fetch_comments($thread_items, bool $pinned, array $activit
|
||||||
while ($row = Post::fetch($thread_items)) {
|
while ($row = Post::fetch($thread_items)) {
|
||||||
if (!empty($activity)) {
|
if (!empty($activity)) {
|
||||||
if (($row['gravity'] == GRAVITY_PARENT)) {
|
if (($row['gravity'] == GRAVITY_PARENT)) {
|
||||||
$row['post-type'] = Item::PT_ANNOUNCEMENT;
|
$row['post-reason'] = Item::PR_ANNOUNCEMENT;
|
||||||
$row = array_merge($row, $activity);
|
$row = array_merge($row, $activity);
|
||||||
$contact = Contact::getById($activity['causer-id'], ['url', 'name', 'thumb']);
|
$contact = Contact::getById($activity['causer-id'], ['url', 'name', 'thumb']);
|
||||||
$row['causer-link'] = $contact['url'];
|
$row['causer-link'] = $contact['url'];
|
||||||
|
@ -739,26 +739,26 @@ function conversation_fetch_comments($thread_items, bool $pinned, array $activit
|
||||||
|
|
||||||
$name = $row['causer-contact-type'] == Contact::TYPE_RELAY ? $row['causer-link'] : $row['causer-name'];
|
$name = $row['causer-contact-type'] == Contact::TYPE_RELAY ? $row['causer-link'] : $row['causer-name'];
|
||||||
|
|
||||||
switch ($row['post-type']) {
|
switch ($row['post-reason']) {
|
||||||
case Item::PT_TO:
|
case Item::PR_TO:
|
||||||
$row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'to')];
|
$row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'to')];
|
||||||
break;
|
break;
|
||||||
case Item::PT_CC:
|
case Item::PR_CC:
|
||||||
$row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'cc')];
|
$row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'cc')];
|
||||||
break;
|
break;
|
||||||
case Item::PT_BTO:
|
case Item::PR_BTO:
|
||||||
$row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bto')];
|
$row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bto')];
|
||||||
break;
|
break;
|
||||||
case Item::PT_BCC:
|
case Item::PR_BCC:
|
||||||
$row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bcc')];
|
$row['direction'] = ['direction' => 7, 'title' => DI::l10n()->t('You had been addressed (%s).', 'bcc')];
|
||||||
break;
|
break;
|
||||||
case Item::PT_FOLLOWER:
|
case Item::PR_FOLLOWER:
|
||||||
$row['direction'] = ['direction' => 6, 'title' => DI::l10n()->t('You are following %s.', $row['author-name'])];
|
$row['direction'] = ['direction' => 6, 'title' => DI::l10n()->t('You are following %s.', $row['author-name'])];
|
||||||
break;
|
break;
|
||||||
case Item::PT_TAG:
|
case Item::PR_TAG:
|
||||||
$row['direction'] = ['direction' => 4, 'title' => DI::l10n()->t('Tagged')];
|
$row['direction'] = ['direction' => 4, 'title' => DI::l10n()->t('Tagged')];
|
||||||
break;
|
break;
|
||||||
case Item::PT_ANNOUNCEMENT:
|
case Item::PR_ANNOUNCEMENT:
|
||||||
if (!empty($row['causer-id']) && DI::pConfig()->get(local_user(), 'system', 'display_resharer')) {
|
if (!empty($row['causer-id']) && DI::pConfig()->get(local_user(), 'system', 'display_resharer')) {
|
||||||
$row['owner-id'] = $row['causer-id'];
|
$row['owner-id'] = $row['causer-id'];
|
||||||
$row['owner-link'] = $row['causer-link'];
|
$row['owner-link'] = $row['causer-link'];
|
||||||
|
@ -773,19 +773,19 @@ function conversation_fetch_comments($thread_items, bool $pinned, array $activit
|
||||||
}
|
}
|
||||||
$row['direction'] = ['direction' => 3, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Reshared') : DI::l10n()->t('Reshared by %s', $name))];
|
$row['direction'] = ['direction' => 3, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Reshared') : DI::l10n()->t('Reshared by %s', $name))];
|
||||||
break;
|
break;
|
||||||
case Item::PT_COMMENT:
|
case Item::PR_COMMENT:
|
||||||
$row['direction'] = ['direction' => 5, 'title' => DI::l10n()->t('%s is participating in this thread.', $row['author-name'])];
|
$row['direction'] = ['direction' => 5, 'title' => DI::l10n()->t('%s is participating in this thread.', $row['author-name'])];
|
||||||
break;
|
break;
|
||||||
case Item::PT_STORED:
|
case Item::PR_STORED:
|
||||||
$row['direction'] = ['direction' => 8, 'title' => DI::l10n()->t('Stored')];
|
$row['direction'] = ['direction' => 8, 'title' => DI::l10n()->t('Stored')];
|
||||||
break;
|
break;
|
||||||
case Item::PT_GLOBAL:
|
case Item::PR_GLOBAL:
|
||||||
$row['direction'] = ['direction' => 9, 'title' => DI::l10n()->t('Global')];
|
$row['direction'] = ['direction' => 9, 'title' => DI::l10n()->t('Global')];
|
||||||
break;
|
break;
|
||||||
case Item::PT_RELAY:
|
case Item::PR_RELAY:
|
||||||
$row['direction'] = ['direction' => 10, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Relayed') : DI::l10n()->t('Relayed by %s.', $name))];
|
$row['direction'] = ['direction' => 10, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Relayed') : DI::l10n()->t('Relayed by %s.', $name))];
|
||||||
break;
|
break;
|
||||||
case Item::PT_FETCHED:
|
case Item::PR_FETCHED:
|
||||||
$row['direction'] = ['direction' => 2, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Fetched') : DI::l10n()->t('Fetched because of %s', $name))];
|
$row['direction'] = ['direction' => 2, 'title' => (empty($row['causer-id']) ? DI::l10n()->t('Fetched') : DI::l10n()->t('Fetched because of %s', $name))];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -878,7 +878,7 @@ function conversation_fetch_items(array $parent, array $items, array $condition,
|
||||||
$condition[0] .= " AND NOT `author-hidden`";
|
$condition[0] .= " AND NOT `author-hidden`";
|
||||||
}
|
}
|
||||||
|
|
||||||
$thread_items = Post::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['pinned', 'contact-uid', 'gravity', 'post-type']), $condition, $params);
|
$thread_items = Post::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['pinned', 'contact-uid', 'gravity', 'post-reason']), $condition, $params);
|
||||||
|
|
||||||
$comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false, $activity);
|
$comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false, $activity);
|
||||||
|
|
||||||
|
|
|
@ -381,6 +381,7 @@ class Event
|
||||||
$item_arr['visible'] = 1;
|
$item_arr['visible'] = 1;
|
||||||
$item_arr['verb'] = Activity::POST;
|
$item_arr['verb'] = Activity::POST;
|
||||||
$item_arr['object-type'] = Activity\ObjectType::EVENT;
|
$item_arr['object-type'] = Activity\ObjectType::EVENT;
|
||||||
|
$item_arr['post-type'] = Item::PT_EVENT;
|
||||||
$item_arr['origin'] = $event['cid'] === 0 ? 1 : 0;
|
$item_arr['origin'] = $event['cid'] === 0 ? 1 : 0;
|
||||||
$item_arr['body'] = self::getBBCode($event);
|
$item_arr['body'] = self::getBBCode($event);
|
||||||
$item_arr['event-id'] = $event['id'];
|
$item_arr['event-id'] = $event['id'];
|
||||||
|
|
|
@ -55,20 +55,23 @@ class Item
|
||||||
const PT_VIDEO = 18;
|
const PT_VIDEO = 18;
|
||||||
const PT_DOCUMENT = 19;
|
const PT_DOCUMENT = 19;
|
||||||
const PT_EVENT = 32;
|
const PT_EVENT = 32;
|
||||||
const PT_TAG = 64;
|
|
||||||
const PT_TO = 65;
|
|
||||||
const PT_CC = 66;
|
|
||||||
const PT_BTO = 67;
|
|
||||||
const PT_BCC = 68;
|
|
||||||
const PT_FOLLOWER = 69;
|
|
||||||
const PT_ANNOUNCEMENT = 70;
|
|
||||||
const PT_COMMENT = 71;
|
|
||||||
const PT_STORED = 72;
|
|
||||||
const PT_GLOBAL = 73;
|
|
||||||
const PT_RELAY = 74;
|
|
||||||
const PT_FETCHED = 75;
|
|
||||||
const PT_PERSONAL_NOTE = 128;
|
const PT_PERSONAL_NOTE = 128;
|
||||||
|
|
||||||
|
// Posting reasons (Why had a post been stored for a user?)
|
||||||
|
const PR_NONE = 0;
|
||||||
|
const PR_TAG = 64;
|
||||||
|
const PR_TO = 65;
|
||||||
|
const PR_CC = 66;
|
||||||
|
const PR_BTO = 67;
|
||||||
|
const PR_BCC = 68;
|
||||||
|
const PR_FOLLOWER = 69;
|
||||||
|
const PR_ANNOUNCEMENT = 70;
|
||||||
|
const PR_COMMENT = 71;
|
||||||
|
const PR_STORED = 72;
|
||||||
|
const PR_GLOBAL = 73;
|
||||||
|
const PR_RELAY = 74;
|
||||||
|
const PR_FETCHED = 75;
|
||||||
|
|
||||||
// Field list that is used to display the items
|
// Field list that is used to display the items
|
||||||
const DISPLAY_FIELDLIST = [
|
const DISPLAY_FIELDLIST = [
|
||||||
'uid', 'id', 'parent', 'guid', 'network', 'gravity',
|
'uid', 'id', 'parent', 'guid', 'network', 'gravity',
|
||||||
|
@ -92,7 +95,7 @@ class Item
|
||||||
const DELIVER_FIELDLIST = ['uid', 'id', 'parent', 'uri-id', 'uri', 'thr-parent', 'parent-uri', 'guid',
|
const DELIVER_FIELDLIST = ['uid', 'id', 'parent', 'uri-id', 'uri', 'thr-parent', 'parent-uri', 'guid',
|
||||||
'parent-guid', 'received', 'created', 'edited', 'verb', 'object-type', 'object', 'target',
|
'parent-guid', 'received', 'created', 'edited', 'verb', 'object-type', 'object', 'target',
|
||||||
'private', 'title', 'body', 'raw-body', 'location', 'coord', 'app',
|
'private', 'title', 'body', 'raw-body', 'location', 'coord', 'app',
|
||||||
'inform', 'deleted', 'extid', 'post-type', 'gravity',
|
'inform', 'deleted', 'extid', 'post-type', 'post-reason', 'gravity',
|
||||||
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
|
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
|
||||||
'author-id', 'author-link', 'author-name', 'author-avatar', 'owner-id', 'owner-link', 'contact-uid',
|
'author-id', 'author-link', 'author-name', 'author-avatar', 'owner-id', 'owner-link', 'contact-uid',
|
||||||
'signed_text', 'network', 'wall', 'contact-id', 'plink', 'forum_mode', 'origin',
|
'signed_text', 'network', 'wall', 'contact-id', 'plink', 'forum_mode', 'origin',
|
||||||
|
@ -107,7 +110,7 @@ class Item
|
||||||
'contact-id', 'wall', 'gravity', 'extid', 'psid',
|
'contact-id', 'wall', 'gravity', 'extid', 'psid',
|
||||||
'created', 'edited', 'commented', 'received', 'changed', 'verb',
|
'created', 'edited', 'commented', 'received', 'changed', 'verb',
|
||||||
'postopts', 'plink', 'resource-id', 'event-id', 'inform',
|
'postopts', 'plink', 'resource-id', 'event-id', 'inform',
|
||||||
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'post-type',
|
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'post-type', 'post-reason',
|
||||||
'private', 'pubmail', 'visible', 'starred',
|
'private', 'pubmail', 'visible', 'starred',
|
||||||
'unseen', 'deleted', 'origin', 'forum_mode', 'mention', 'global', 'network',
|
'unseen', 'deleted', 'origin', 'forum_mode', 'mention', 'global', 'network',
|
||||||
'title', 'content-warning', 'body', 'location', 'coord', 'app',
|
'title', 'content-warning', 'body', 'location', 'coord', 'app',
|
||||||
|
@ -744,6 +747,10 @@ class Item
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($item['post-type'])) {
|
||||||
|
$item['post-type'] = empty($item['title']) ? self::PT_NOTE : self::PT_ARTICLE;
|
||||||
|
}
|
||||||
|
|
||||||
$item['wall'] = intval($item['wall'] ?? 0);
|
$item['wall'] = intval($item['wall'] ?? 0);
|
||||||
$item['extid'] = trim($item['extid'] ?? '');
|
$item['extid'] = trim($item['extid'] ?? '');
|
||||||
$item['author-name'] = trim($item['author-name'] ?? '');
|
$item['author-name'] = trim($item['author-name'] ?? '');
|
||||||
|
@ -762,7 +769,6 @@ class Item
|
||||||
$item['coord'] = trim($item['coord'] ?? '');
|
$item['coord'] = trim($item['coord'] ?? '');
|
||||||
$item['visible'] = (isset($item['visible']) ? intval($item['visible']) : 1);
|
$item['visible'] = (isset($item['visible']) ? intval($item['visible']) : 1);
|
||||||
$item['deleted'] = 0;
|
$item['deleted'] = 0;
|
||||||
$item['post-type'] = ($item['post-type'] ?? '') ?: self::PT_ARTICLE;
|
|
||||||
$item['verb'] = trim($item['verb'] ?? '');
|
$item['verb'] = trim($item['verb'] ?? '');
|
||||||
$item['object-type'] = trim($item['object-type'] ?? '');
|
$item['object-type'] = trim($item['object-type'] ?? '');
|
||||||
$item['object'] = trim($item['object'] ?? '');
|
$item['object'] = trim($item['object'] ?? '');
|
||||||
|
@ -810,7 +816,7 @@ class Item
|
||||||
|
|
||||||
$actor = ($item['gravity'] == GRAVITY_PARENT) ? $item['owner-id'] : $item['author-id'];
|
$actor = ($item['gravity'] == GRAVITY_PARENT) ? $item['owner-id'] : $item['author-id'];
|
||||||
if (!$item['origin'] && ($item['uid'] != 0) && Contact::isSharing($actor, $item['uid'])) {
|
if (!$item['origin'] && ($item['uid'] != 0) && Contact::isSharing($actor, $item['uid'])) {
|
||||||
$item['post-type'] = self::PT_FOLLOWER;
|
$item['post-reason'] = self::PR_FOLLOWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that there is an avatar cache
|
// Ensure that there is an avatar cache
|
||||||
|
@ -1115,7 +1121,7 @@ class Item
|
||||||
*/
|
*/
|
||||||
private static function setOwnerforResharedItem(array $item)
|
private static function setOwnerforResharedItem(array $item)
|
||||||
{
|
{
|
||||||
$parent = Post::selectFirst(['id', 'causer-id', 'owner-id', 'author-id', 'author-link', 'origin', 'post-type'],
|
$parent = Post::selectFirst(['id', 'causer-id', 'owner-id', 'author-id', 'author-link', 'origin', 'post-reason'],
|
||||||
['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
|
['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
|
||||||
if (!DBA::isResult($parent)) {
|
if (!DBA::isResult($parent)) {
|
||||||
Logger::error('Parent not found', ['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
|
Logger::error('Parent not found', ['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
|
||||||
|
@ -1135,7 +1141,7 @@ class Item
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($author['contact-type'] != Contact::TYPE_COMMUNITY) {
|
if ($author['contact-type'] != Contact::TYPE_COMMUNITY) {
|
||||||
if ($parent['post-type'] == self::PT_ANNOUNCEMENT) {
|
if ($parent['post-reason'] == self::PR_ANNOUNCEMENT) {
|
||||||
Logger::info('The parent is already marked as announced: quit', ['causer' => $parent['causer-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
|
Logger::info('The parent is already marked as announced: quit', ['causer' => $parent['causer-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1144,8 +1150,8 @@ class Item
|
||||||
Logger::info('The resharer is no forum: quit', ['resharer' => $item['author-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
|
Logger::info('The resharer is no forum: quit', ['resharer' => $item['author-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self::update(['post-type' => self::PT_ANNOUNCEMENT, 'causer-id' => $item['author-id']], ['id' => $parent['id']]);
|
self::update(['post-reason' => self::PR_ANNOUNCEMENT, 'causer-id' => $item['author-id']], ['id' => $parent['id']]);
|
||||||
Logger::info('Set announcement post-type', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
|
Logger::info('Set announcement post-reason', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1169,7 +1175,7 @@ class Item
|
||||||
if (Contact::isSharing($item['author-id'], $uid)) {
|
if (Contact::isSharing($item['author-id'], $uid)) {
|
||||||
$fields = [];
|
$fields = [];
|
||||||
} else {
|
} else {
|
||||||
$fields = ['post-type' => self::PT_TAG];
|
$fields = ['post-reason' => self::PR_TAG];
|
||||||
}
|
}
|
||||||
|
|
||||||
$stored = self::storeForUserByUriId($item['uri-id'], $uid, $fields);
|
$stored = self::storeForUserByUriId($item['uri-id'], $uid, $fields);
|
||||||
|
@ -1289,7 +1295,7 @@ class Item
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item['post-type'] = self::PT_STORED;
|
$item['post-reason'] = self::PR_STORED;
|
||||||
|
|
||||||
$item = array_merge($item, $fields);
|
$item = array_merge($item, $fields);
|
||||||
|
|
||||||
|
@ -1416,7 +1422,7 @@ class Item
|
||||||
unset($item['starred']);
|
unset($item['starred']);
|
||||||
unset($item['postopts']);
|
unset($item['postopts']);
|
||||||
unset($item['inform']);
|
unset($item['inform']);
|
||||||
unset($item['post-type']);
|
unset($item['post-reason']);
|
||||||
if ($item['uri-id'] == $item['parent-uri-id']) {
|
if ($item['uri-id'] == $item['parent-uri-id']) {
|
||||||
$item['contact-id'] = $item['owner-id'];
|
$item['contact-id'] = $item['owner-id'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -1479,7 +1485,7 @@ class Item
|
||||||
unset($item['starred']);
|
unset($item['starred']);
|
||||||
unset($item['postopts']);
|
unset($item['postopts']);
|
||||||
unset($item['inform']);
|
unset($item['inform']);
|
||||||
unset($item['post-type']);
|
unset($item['post-reason']);
|
||||||
$item['contact-id'] = Contact::getIdForURL($item['author-link']);
|
$item['contact-id'] = Contact::getIdForURL($item['author-link']);
|
||||||
|
|
||||||
$public_shadow = self::insert($item, false, true);
|
$public_shadow = self::insert($item, false, true);
|
||||||
|
@ -2157,7 +2163,7 @@ class Item
|
||||||
|
|
||||||
// Only expire posts, not photos and photo comments
|
// Only expire posts, not photos and photo comments
|
||||||
|
|
||||||
if (!$expire_photos && (!empty($item['resource-id']) || ($item['post-type'] == self::PT_IMAGE))) {
|
if (!$expire_photos && !empty($item['resource-id'])) {
|
||||||
continue;
|
continue;
|
||||||
} elseif (!$expire_starred && intval($item['starred'])) {
|
} elseif (!$expire_starred && intval($item['starred'])) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -2696,21 +2702,31 @@ class Item
|
||||||
|
|
||||||
if (($filetype == 'video')) {
|
if (($filetype == 'video')) {
|
||||||
/// @todo Move the template to /content as well
|
/// @todo Move the template to /content as well
|
||||||
$leading .= Renderer::replaceMacros(Renderer::getMarkupTemplate('video_top.tpl'), [
|
$media = Renderer::replaceMacros(Renderer::getMarkupTemplate('video_top.tpl'), [
|
||||||
'$video' => [
|
'$video' => [
|
||||||
'id' => $item['author-id'],
|
'id' => $item['author-id'],
|
||||||
'src' => $the_url,
|
'src' => $the_url,
|
||||||
'mime' => $mime,
|
'mime' => $mime,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
if ($item['post-type'] == Item::PT_VIDEO) {
|
||||||
|
$leading .= $media;
|
||||||
|
} else {
|
||||||
|
$trailing .= $media;
|
||||||
|
}
|
||||||
} elseif ($filetype == 'audio') {
|
} elseif ($filetype == 'audio') {
|
||||||
$leading .= Renderer::replaceMacros(Renderer::getMarkupTemplate('content/audio.tpl'), [
|
$media = Renderer::replaceMacros(Renderer::getMarkupTemplate('content/audio.tpl'), [
|
||||||
'$audio' => [
|
'$audio' => [
|
||||||
'id' => $item['author-id'],
|
'id' => $item['author-id'],
|
||||||
'src' => $the_url,
|
'src' => $the_url,
|
||||||
'mime' => $mime,
|
'mime' => $mime,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
if ($item['post-type'] == Item::PT_AUDIO) {
|
||||||
|
$leading .= $media;
|
||||||
|
} else {
|
||||||
|
$trailing .= $media;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$title = Strings::escapeHtml(trim(($attachment['description'] ?? '') ?: $attachment['url']));
|
$title = Strings::escapeHtml(trim(($attachment['description'] ?? '') ?: $attachment['url']));
|
||||||
|
|
||||||
|
|
|
@ -198,31 +198,47 @@ class Processor
|
||||||
|
|
||||||
// image is the preview/thumbnail URL
|
// image is the preview/thumbnail URL
|
||||||
if (!empty($attach['image'])) {
|
if (!empty($attach['image'])) {
|
||||||
$trailing .= '[url=' . $attach['url'] . ']';
|
$media = '[url=' . $attach['url'] . ']';
|
||||||
$attach['url'] = $attach['image'];
|
$attach['url'] = $attach['image'];
|
||||||
|
} else {
|
||||||
|
$media = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($attach['name'])) {
|
if (empty($attach['name'])) {
|
||||||
$trailing .= '[img]' . $attach['url'] . '[/img]';
|
$media .= '[img]' . $attach['url'] . '[/img]';
|
||||||
} else {
|
} else {
|
||||||
$trailing .= '[img=' . $attach['url'] . ']' . $attach['name'] . '[/img]';
|
$media .= '[img=' . $attach['url'] . ']' . $attach['name'] . '[/img]';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($attach['image'])) {
|
if (!empty($attach['image'])) {
|
||||||
$trailing .= '[/url]';
|
$media .= '[/url]';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($item['post-type'] == Item::PT_IMAGE) {
|
||||||
|
$leading .= $media;
|
||||||
|
} else {
|
||||||
|
$trailing .= $media;
|
||||||
|
}
|
||||||
} elseif ($filetype == 'audio') {
|
} elseif ($filetype == 'audio') {
|
||||||
if (!empty($activity['source']) && strpos($activity['source'], $attach['url'])) {
|
if (!empty($activity['source']) && strpos($activity['source'], $attach['url'])) {
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$leading .= '[audio]' . $attach['url'] . "[/audio]\n";
|
if ($item['post-type'] == Item::PT_AUDIO) {
|
||||||
|
$leading .= '[audio]' . $attach['url'] . "[/audio]\n";
|
||||||
|
} else {
|
||||||
|
$trailing .= '[audio]' . $attach['url'] . "[/audio]\n";
|
||||||
|
}
|
||||||
} elseif ($filetype == 'video') {
|
} elseif ($filetype == 'video') {
|
||||||
if (!empty($activity['source']) && strpos($activity['source'], $attach['url'])) {
|
if (!empty($activity['source']) && strpos($activity['source'], $attach['url'])) {
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$leading .= '[video]' . $attach['url'] . "[/video]\n";
|
if ($item['post-type'] == Item::PT_VIDEO) {
|
||||||
|
$leading .= '[video]' . $attach['url'] . "[/video]\n";
|
||||||
|
} else {
|
||||||
|
$trailing .= '[video]' . $attach['url'] . "[/video]\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +266,7 @@ class Processor
|
||||||
*/
|
*/
|
||||||
public static function updateItem($activity)
|
public static function updateItem($activity)
|
||||||
{
|
{
|
||||||
$item = Post::selectFirst(['uri', 'uri-id', 'thr-parent', 'gravity'], ['uri' => $activity['id']]);
|
$item = Post::selectFirst(['uri', 'uri-id', 'thr-parent', 'gravity', 'post-type'], ['uri' => $activity['id']]);
|
||||||
if (!DBA::isResult($item)) {
|
if (!DBA::isResult($item)) {
|
||||||
Logger::warning('No existing item, item will be created', ['uri' => $activity['id']]);
|
Logger::warning('No existing item, item will be created', ['uri' => $activity['id']]);
|
||||||
$item = self::createItem($activity);
|
$item = self::createItem($activity);
|
||||||
|
@ -336,6 +352,24 @@ class Processor
|
||||||
$item['direction'] = Conversation::RELAY;
|
$item['direction'] = Conversation::RELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($activity['object_type'] == 'as:Article') {
|
||||||
|
$item['post-type'] = Item::PT_ARTICLE;
|
||||||
|
} elseif ($activity['object_type'] == 'as:Audio') {
|
||||||
|
$item['post-type'] = Item::PT_AUDIO;
|
||||||
|
} elseif ($activity['object_type'] == 'as:Document') {
|
||||||
|
$item['post-type'] = Item::PT_DOCUMENT;
|
||||||
|
} elseif ($activity['object_type'] == 'as:Event') {
|
||||||
|
$item['post-type'] = Item::PT_EVENT;
|
||||||
|
} elseif ($activity['object_type'] == 'as:Image') {
|
||||||
|
$item['post-type'] = Item::PT_IMAGE;
|
||||||
|
} elseif ($activity['object_type'] == 'as:Page') {
|
||||||
|
$item['post-type'] = Item::PT_PAGE;
|
||||||
|
} elseif ($activity['object_type'] == 'as:Video') {
|
||||||
|
$item['post-type'] = Item::PT_VIDEO;
|
||||||
|
} else {
|
||||||
|
$item['post-type'] = Item::PT_NOTE;
|
||||||
|
}
|
||||||
|
|
||||||
$item['isForum'] = false;
|
$item['isForum'] = false;
|
||||||
|
|
||||||
if (!empty($activity['thread-completion'])) {
|
if (!empty($activity['thread-completion'])) {
|
||||||
|
@ -456,6 +490,7 @@ class Processor
|
||||||
$item['verb'] = $verb;
|
$item['verb'] = $verb;
|
||||||
$item['thr-parent'] = $activity['object_id'];
|
$item['thr-parent'] = $activity['object_id'];
|
||||||
$item['gravity'] = GRAVITY_ACTIVITY;
|
$item['gravity'] = GRAVITY_ACTIVITY;
|
||||||
|
unset($item['post-type']);
|
||||||
$item['object-type'] = Activity\ObjectType::NOTE;
|
$item['object-type'] = Activity\ObjectType::NOTE;
|
||||||
|
|
||||||
$item['diaspora_signed_text'] = $activity['diaspora:like'] ?? '';
|
$item['diaspora_signed_text'] = $activity['diaspora:like'] ?? '';
|
||||||
|
@ -629,34 +664,34 @@ class Processor
|
||||||
$type = $activity['reception_type'][$receiver] ?? Receiver::TARGET_UNKNOWN;
|
$type = $activity['reception_type'][$receiver] ?? Receiver::TARGET_UNKNOWN;
|
||||||
switch($type) {
|
switch($type) {
|
||||||
case Receiver::TARGET_TO:
|
case Receiver::TARGET_TO:
|
||||||
$item['post-type'] = Item::PT_TO;
|
$item['post-reason'] = Item::PR_TO;
|
||||||
break;
|
break;
|
||||||
case Receiver::TARGET_CC:
|
case Receiver::TARGET_CC:
|
||||||
$item['post-type'] = Item::PT_CC;
|
$item['post-reason'] = Item::PR_CC;
|
||||||
break;
|
break;
|
||||||
case Receiver::TARGET_BTO:
|
case Receiver::TARGET_BTO:
|
||||||
$item['post-type'] = Item::PT_BTO;
|
$item['post-reason'] = Item::PR_BTO;
|
||||||
break;
|
break;
|
||||||
case Receiver::TARGET_BCC:
|
case Receiver::TARGET_BCC:
|
||||||
$item['post-type'] = Item::PT_BCC;
|
$item['post-reason'] = Item::PR_BCC;
|
||||||
break;
|
break;
|
||||||
case Receiver::TARGET_FOLLOWER:
|
case Receiver::TARGET_FOLLOWER:
|
||||||
$item['post-type'] = Item::PT_FOLLOWER;
|
$item['post-reason'] = Item::PR_FOLLOWER;
|
||||||
break;
|
break;
|
||||||
case Receiver::TARGET_ANSWER:
|
case Receiver::TARGET_ANSWER:
|
||||||
$item['post-type'] = Item::PT_COMMENT;
|
$item['post-reason'] = Item::PR_COMMENT;
|
||||||
break;
|
break;
|
||||||
case Receiver::TARGET_GLOBAL:
|
case Receiver::TARGET_GLOBAL:
|
||||||
$item['post-type'] = Item::PT_GLOBAL;
|
$item['post-reason'] = Item::PR_GLOBAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$item['post-type'] = Item::PT_ARTICLE;
|
$item['post-reason'] = Item::PR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($activity['from-relay'])) {
|
if (!empty($activity['from-relay'])) {
|
||||||
$item['post-type'] = Item::PT_RELAY;
|
$item['post-reason'] = Item::PR_RELAY;
|
||||||
} elseif (!empty($activity['thread-completion'])) {
|
} elseif (!empty($activity['thread-completion'])) {
|
||||||
$item['post-type'] = Item::PT_FETCHED;
|
$item['post-reason'] = Item::PR_FETCHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item['isForum'] ?? false) {
|
if ($item['isForum'] ?? false) {
|
||||||
|
|
|
@ -522,7 +522,7 @@ class Receiver
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item['post-type'] = Item::PT_ANNOUNCEMENT;
|
$item['post-reason'] = Item::PR_ANNOUNCEMENT;
|
||||||
ActivityPub\Processor::postItem($object_data, $item);
|
ActivityPub\Processor::postItem($object_data, $item);
|
||||||
|
|
||||||
$announce_object_data = self::processObject($activity);
|
$announce_object_data = self::processObject($activity);
|
||||||
|
|
|
@ -2195,6 +2195,12 @@ class DFRN
|
||||||
|
|
||||||
$item["title"] = XML::getFirstNodeValue($xpath, "atom:title/text()", $entry);
|
$item["title"] = XML::getFirstNodeValue($xpath, "atom:title/text()", $entry);
|
||||||
|
|
||||||
|
if (!empty($item["title"])) {
|
||||||
|
$item["post-type"] = Item::PT_ARTICLE;
|
||||||
|
} else {
|
||||||
|
$item["post-type"] = Item::PT_NOTE;
|
||||||
|
}
|
||||||
|
|
||||||
$item["created"] = XML::getFirstNodeValue($xpath, "atom:published/text()", $entry);
|
$item["created"] = XML::getFirstNodeValue($xpath, "atom:published/text()", $entry);
|
||||||
|
|
||||||
$item["body"] = XML::getFirstNodeValue($xpath, "dfrn:env/text()", $entry);
|
$item["body"] = XML::getFirstNodeValue($xpath, "dfrn:env/text()", $entry);
|
||||||
|
@ -2426,8 +2432,8 @@ class DFRN
|
||||||
|
|
||||||
if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
|
if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
|
||||||
// Will be overwritten for sharing accounts in Item::insert
|
// Will be overwritten for sharing accounts in Item::insert
|
||||||
if (empty($item['post-type']) && ($entrytype == DFRN::REPLY)) {
|
if (empty($item['post-reason']) && ($entrytype == DFRN::REPLY)) {
|
||||||
$item['post-type'] = Item::PT_COMMENT;
|
$item['post-reason'] = Item::PR_COMMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
$posted_id = Item::insert($item);
|
$posted_id = Item::insert($item);
|
||||||
|
@ -2588,7 +2594,7 @@ class DFRN
|
||||||
$header["direction"] = $direction;
|
$header["direction"] = $direction;
|
||||||
|
|
||||||
if ($direction === Conversation::RELAY) {
|
if ($direction === Conversation::RELAY) {
|
||||||
$header['post-type'] = Item::PT_RELAY;
|
$header['post-reason'] = Item::PR_RELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the contact table if the data has changed
|
// Update the contact table if the data has changed
|
||||||
|
|
|
@ -1536,11 +1536,11 @@ class Diaspora
|
||||||
|
|
||||||
// Will be overwritten for sharing accounts in Item::insert
|
// Will be overwritten for sharing accounts in Item::insert
|
||||||
if ($fetched) {
|
if ($fetched) {
|
||||||
$datarray["post-type"] = Item::PT_FETCHED;
|
$datarray["post-reason"] = Item::PR_FETCHED;
|
||||||
} elseif ($datarray["uid"] == 0) {
|
} elseif ($datarray["uid"] == 0) {
|
||||||
$datarray["post-type"] = Item::PT_GLOBAL;
|
$datarray["post-reason"] = Item::PR_GLOBAL;
|
||||||
} else {
|
} else {
|
||||||
$datarray["post-type"] = Item::PT_COMMENT;
|
$datarray["post-reason"] = Item::PR_COMMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
$datarray["guid"] = $guid;
|
$datarray["guid"] = $guid;
|
||||||
|
@ -1553,6 +1553,7 @@ class Diaspora
|
||||||
$datarray['thr-parent'] = $thr_parent ?: $toplevel_parent_item['uri'];
|
$datarray['thr-parent'] = $thr_parent ?: $toplevel_parent_item['uri'];
|
||||||
|
|
||||||
$datarray["object-type"] = Activity\ObjectType::COMMENT;
|
$datarray["object-type"] = Activity\ObjectType::COMMENT;
|
||||||
|
$datarray["post-type"] = Item::PT_NOTE;
|
||||||
|
|
||||||
$datarray["protocol"] = Conversation::PARCEL_DIASPORA;
|
$datarray["protocol"] = Conversation::PARCEL_DIASPORA;
|
||||||
$datarray["source"] = $xml;
|
$datarray["source"] = $xml;
|
||||||
|
@ -2737,8 +2738,10 @@ class Diaspora
|
||||||
}
|
}
|
||||||
|
|
||||||
$datarray["object-type"] = Activity\ObjectType::IMAGE;
|
$datarray["object-type"] = Activity\ObjectType::IMAGE;
|
||||||
|
$datarray["post-type"] = Item::PT_IMAGE;
|
||||||
} else {
|
} else {
|
||||||
$datarray["object-type"] = Activity\ObjectType::NOTE;
|
$datarray["object-type"] = Activity\ObjectType::NOTE;
|
||||||
|
$datarray["post-type"] = Item::PT_NOTE;
|
||||||
|
|
||||||
// Add OEmbed and other information to the body
|
// Add OEmbed and other information to the body
|
||||||
if (!self::isHubzilla($contact["url"])) {
|
if (!self::isHubzilla($contact["url"])) {
|
||||||
|
@ -2773,9 +2776,9 @@ class Diaspora
|
||||||
$datarray["direction"] = $fetched ? Conversation::PULL : Conversation::PUSH;
|
$datarray["direction"] = $fetched ? Conversation::PULL : Conversation::PUSH;
|
||||||
|
|
||||||
if ($fetched) {
|
if ($fetched) {
|
||||||
$datarray["post-type"] = Item::PT_FETCHED;
|
$datarray["post-reason"] = Item::PR_FETCHED;
|
||||||
} elseif ($datarray["uid"] == 0) {
|
} elseif ($datarray["uid"] == 0) {
|
||||||
$datarray["post-type"] = Item::PT_GLOBAL;
|
$datarray["post-reason"] = Item::PR_GLOBAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$datarray["body"] = self::replacePeopleGuid($body, $contact["url"]);
|
$datarray["body"] = self::replacePeopleGuid($body, $contact["url"]);
|
||||||
|
|
|
@ -235,6 +235,7 @@ class Feed
|
||||||
$header["private"] = Item::PUBLIC;
|
$header["private"] = Item::PUBLIC;
|
||||||
$header["verb"] = Activity::POST;
|
$header["verb"] = Activity::POST;
|
||||||
$header["object-type"] = Activity\ObjectType::NOTE;
|
$header["object-type"] = Activity\ObjectType::NOTE;
|
||||||
|
$header["post-type"] = Item::PT_ARTICLE;
|
||||||
|
|
||||||
$header["contact-id"] = $contact["id"] ?? 0;
|
$header["contact-id"] = $contact["id"] ?? 0;
|
||||||
|
|
||||||
|
@ -539,6 +540,10 @@ class Feed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($item['title'])) {
|
||||||
|
$item['post-type'] = Item::PT_NOTE;
|
||||||
|
}
|
||||||
|
|
||||||
Logger::info('Stored feed', ['item' => $item]);
|
Logger::info('Stored feed', ['item' => $item]);
|
||||||
|
|
||||||
$notify = Item::isRemoteSelf($contact, $item);
|
$notify = Item::isRemoteSelf($contact, $item);
|
||||||
|
|
|
@ -224,10 +224,10 @@ class ExpirePosts
|
||||||
AND NOT `uri-id` IN (SELECT `parent-uri-id` FROM `post-user` INNER JOIN `contact` ON `contact`.`id` = `contact-id` AND `notify_new_posts`
|
AND NOT `uri-id` IN (SELECT `parent-uri-id` FROM `post-user` INNER JOIN `contact` ON `contact`.`id` = `contact-id` AND `notify_new_posts`
|
||||||
WHERE `parent-uri-id` = `post-thread`.`uri-id`)
|
WHERE `parent-uri-id` = `post-thread`.`uri-id`)
|
||||||
AND NOT `uri-id` IN (SELECT `parent-uri-id` FROM `post-user`
|
AND NOT `uri-id` IN (SELECT `parent-uri-id` FROM `post-user`
|
||||||
WHERE (`origin` OR `event-id` != 0 OR `post-type` IN (?, ?)) AND `parent-uri-id` = `post-thread`.`uri-id`)
|
WHERE (`origin` OR `event-id` != 0 OR `post-type` = ?) AND `parent-uri-id` = `post-thread`.`uri-id`)
|
||||||
AND NOT `uri-id` IN (SELECT `uri-id` FROM `post-content`
|
AND NOT `uri-id` IN (SELECT `uri-id` FROM `post-content`
|
||||||
WHERE `resource-id` != 0 AND `uri-id` = `post-thread`.`uri-id`))",
|
WHERE `resource-id` != 0 AND `uri-id` = `post-thread`.`uri-id`))",
|
||||||
$expire_days, Item::PT_PERSONAL_NOTE, Item::PT_IMAGE]);
|
$expire_days, Item::PT_PERSONAL_NOTE]);
|
||||||
|
|
||||||
Logger::notice('Start deleting expired threads');
|
Logger::notice('Start deleting expired threads');
|
||||||
$affected_count = 0;
|
$affected_count = 0;
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1412);
|
define('DB_UPDATE_VERSION', 1413);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -998,7 +998,7 @@ return [
|
||||||
"owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the owner of this item"],
|
"owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the owner of this item"],
|
||||||
"author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the author of this item"],
|
"author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the author of this item"],
|
||||||
"causer-id" => ["type" => "int unsigned", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the contact that caused the item creation"],
|
"causer-id" => ["type" => "int unsigned", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the contact that caused the item creation"],
|
||||||
"post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
|
"post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, image, article, ...)"],
|
||||||
"vid" => ["type" => "smallint unsigned", "foreign" => ["verb" => "id", "on delete" => "restrict"], "comment" => "Id of the verb table entry that contains the activity verbs"],
|
"vid" => ["type" => "smallint unsigned", "foreign" => ["verb" => "id", "on delete" => "restrict"], "comment" => "Id of the verb table entry that contains the activity verbs"],
|
||||||
"private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
|
"private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
|
||||||
"global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
"global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
||||||
|
@ -1150,7 +1150,8 @@ return [
|
||||||
"owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the owner of this item"],
|
"owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the owner of this item"],
|
||||||
"author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the author of this item"],
|
"author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the author of this item"],
|
||||||
"causer-id" => ["type" => "int unsigned", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the contact that caused the item creation"],
|
"causer-id" => ["type" => "int unsigned", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Link to the contact table with uid=0 of the contact that caused the item creation"],
|
||||||
"post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
|
"post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, image, article, ...)"],
|
||||||
|
"post-reason" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Reason why the post arrived at the user"],
|
||||||
"vid" => ["type" => "smallint unsigned", "foreign" => ["verb" => "id", "on delete" => "restrict"], "comment" => "Id of the verb table entry that contains the activity verbs"],
|
"vid" => ["type" => "smallint unsigned", "foreign" => ["verb" => "id", "on delete" => "restrict"], "comment" => "Id of the verb table entry that contains the activity verbs"],
|
||||||
"private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
|
"private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
|
||||||
"global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
"global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
"received" => ["post-user", "received"],
|
"received" => ["post-user", "received"],
|
||||||
"changed" => ["post-thread-user", "changed"],
|
"changed" => ["post-thread-user", "changed"],
|
||||||
"post-type" => ["post-user", "post-type"],
|
"post-type" => ["post-user", "post-type"],
|
||||||
|
"post-reason" => ["post-user", "post-reason"],
|
||||||
"private" => ["post-user", "private"],
|
"private" => ["post-user", "private"],
|
||||||
"pubmail" => ["post-thread-user", "pubmail"],
|
"pubmail" => ["post-thread-user", "pubmail"],
|
||||||
"visible" => ["post-user", "visible"],
|
"visible" => ["post-user", "visible"],
|
||||||
|
@ -217,6 +218,7 @@
|
||||||
"received" => ["post-thread-user", "received"],
|
"received" => ["post-thread-user", "received"],
|
||||||
"changed" => ["post-thread-user", "changed"],
|
"changed" => ["post-thread-user", "changed"],
|
||||||
"post-type" => ["post-user", "post-type"],
|
"post-type" => ["post-user", "post-type"],
|
||||||
|
"post-reason" => ["post-user", "post-reason"],
|
||||||
"private" => ["post-user", "private"],
|
"private" => ["post-user", "private"],
|
||||||
"pubmail" => ["post-thread-user", "pubmail"],
|
"pubmail" => ["post-thread-user", "pubmail"],
|
||||||
"ignored" => ["post-thread-user", "ignored"],
|
"ignored" => ["post-thread-user", "ignored"],
|
||||||
|
|
11
update.php
11
update.php
|
@ -883,6 +883,8 @@ function update_1404()
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
DBA::update('workerqueue', ['parameter' => json_encode($parameters)], ['id' => $task['id']]);
|
DBA::update('workerqueue', ['parameter' => json_encode($parameters)], ['id' => $task['id']]);
|
||||||
|
|
||||||
|
return Update::SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,4 +902,13 @@ function update_1407()
|
||||||
if (!DBA::e("UPDATE `post-thread-user` SET `causer-id` = NULL WHERE `causer-id` = 0")) {
|
if (!DBA::e("UPDATE `post-thread-user` SET `causer-id` = NULL WHERE `causer-id` = 0")) {
|
||||||
return Update::FAILED;
|
return Update::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Update::SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_1413()
|
||||||
|
{
|
||||||
|
if (!DBA::e("UPDATE `post-user` SET `post-reason` = `post-type` WHERE `post-type` >= 64 and `post-type` <= 75")) {
|
||||||
|
return Update::FAILED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue