Store the push/pull direction in the conversation table
This commit is contained in:
parent
6f0d40c6c0
commit
af6db65961
5 changed files with 27 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 2020.03-dev (Dalmatian Bellflower)
|
||||
-- DB_UPDATE_VERSION 1334
|
||||
-- DB_UPDATE_VERSION 1335
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -279,6 +279,7 @@ CREATE TABLE IF NOT EXISTS `conversation` (
|
|||
`conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
|
||||
`conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
|
||||
`protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
|
||||
`direction` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'How the message arrived here: 1=push, 2=pull',
|
||||
`source` mediumtext COMMENT 'Original source',
|
||||
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
|
||||
PRIMARY KEY(`item-uri`),
|
||||
|
|
|
@ -41,6 +41,19 @@ class Conversation
|
|||
const PARCEL_TWITTER = 67;
|
||||
const PARCEL_UNKNOWN = 255;
|
||||
|
||||
/**
|
||||
* Unknown message direction
|
||||
*/
|
||||
const UNKNOWN = 0;
|
||||
/**
|
||||
* The message had been pushed to this sytem
|
||||
*/
|
||||
const PUSH = 1;
|
||||
/**
|
||||
* The message had been fetched by our system
|
||||
*/
|
||||
const PULL = 2;
|
||||
|
||||
public static function getByItemUri($item_uri)
|
||||
{
|
||||
return DBA::selectFirst('conversation', [], ['item-uri' => $item_uri]);
|
||||
|
@ -79,6 +92,10 @@ class Conversation
|
|||
$conversation['protocol'] = $arr['protocol'];
|
||||
}
|
||||
|
||||
if (isset($arr['direction'])) {
|
||||
$conversation['direction'] = $arr['direction'];
|
||||
}
|
||||
|
||||
if (isset($arr['source'])) {
|
||||
$conversation['source'] = $arr['source'];
|
||||
}
|
||||
|
|
|
@ -490,12 +490,7 @@ class Processor
|
|||
}
|
||||
|
||||
if (isset($activity['push'])) {
|
||||
$push_app = $activity['push'] ? '📨' : '🚜';
|
||||
if (!empty($item['app'])) {
|
||||
$item['app'] .= ' (' . $push_app . ')';
|
||||
} else {
|
||||
$item['app'] .= $push_app;
|
||||
}
|
||||
$item['direction'] = $activity['push'] ? Conversation::PUSH : Conversation::PULL;
|
||||
}
|
||||
|
||||
$item['plink'] = $activity['alternate-url'] ?? $item['uri'];
|
||||
|
|
|
@ -174,9 +174,10 @@ class Receiver
|
|||
/**
|
||||
* Prepare the object array
|
||||
*
|
||||
* @param array $activity
|
||||
* @param integer $uid User ID
|
||||
* @param $trust_source
|
||||
* @param array $activity Array with activity data
|
||||
* @param integer $uid User ID
|
||||
* @param boolean $push Message had been pushed to our system
|
||||
* @param boolean $trust_source Do we trust the source?
|
||||
*
|
||||
* @return array with object data
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
|
@ -312,6 +313,7 @@ class Receiver
|
|||
* @param string $body
|
||||
* @param integer $uid User ID
|
||||
* @param boolean $trust_source Do we trust the source?
|
||||
* @param boolean $push Message had been pushed to our system
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function processActivity($activity, $body = '', $uid = null, $trust_source = false, $push = false)
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
use Friendica\Database\DBA;
|
||||
|
||||
if (!defined('DB_UPDATE_VERSION')) {
|
||||
define('DB_UPDATE_VERSION', 1334);
|
||||
define('DB_UPDATE_VERSION', 1335);
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -342,6 +342,7 @@ return [
|
|||
"conversation-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation URI"],
|
||||
"conversation-href" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation link"],
|
||||
"protocol" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "255", "comment" => "The protocol of the item"],
|
||||
"direction" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "How the message arrived here: 1=push, 2=pull"],
|
||||
"source" => ["type" => "mediumtext", "comment" => "Original source"],
|
||||
"received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Receiving date"],
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue