AP: We now transmit "add tag" activity / On Diaspora this is now supressed
This commit is contained in:
parent
22fc3c8828
commit
32b1f75ece
2 changed files with 30 additions and 1 deletions
|
@ -21,6 +21,7 @@ use Friendica\Model\User;
|
|||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\Plaintext;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Util\JsonLD;
|
||||
use Friendica\Util\LDSignature;
|
||||
use Friendica\Model\Profile;
|
||||
|
@ -772,6 +773,8 @@ class Transmitter
|
|||
$type = 'TentativeAccept';
|
||||
} elseif ($item['verb'] == ACTIVITY_FOLLOW) {
|
||||
$type = 'Follow';
|
||||
} elseif ($item['verb'] == ACTIVITY_TAG) {
|
||||
$type = 'Add';
|
||||
} else {
|
||||
$type = '';
|
||||
}
|
||||
|
@ -875,6 +878,8 @@ class Transmitter
|
|||
|
||||
if (in_array($data['type'], ['Create', 'Update', 'Delete'])) {
|
||||
$data['object'] = self::createNote($item);
|
||||
} elseif ($data['type'] == 'Add') {
|
||||
$data = self::createAddTag($item, $data);
|
||||
} elseif ($data['type'] == 'Announce') {
|
||||
$data = self::createAnnounce($item, $data);
|
||||
} elseif ($data['type'] == 'Follow') {
|
||||
|
@ -1251,6 +1256,30 @@ class Transmitter
|
|||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an an "add tag" entry
|
||||
*
|
||||
* @param array $item
|
||||
* @param array $data activity data
|
||||
*
|
||||
* @return array with activity data for adding tags
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
private static function createAddTag($item, $data)
|
||||
{
|
||||
$object = XML::parseString($item['object'], false);
|
||||
$target = XML::parseString($item["target"], false);
|
||||
|
||||
$data['diaspora:guid'] = $item['guid'];
|
||||
$data['actor'] = $item['author-link'];
|
||||
$data['target'] = (string)$target->id;
|
||||
$data['summary'] = BBCode::toPlaintext($item['body']);
|
||||
$data['object'] = ['id' => (string)$object->id, 'type' => 'tag', 'name' => (string)$object->title, 'content' => (string)$object->content];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an announce object entry
|
||||
*
|
||||
|
|
|
@ -3834,7 +3834,7 @@ class Diaspora
|
|||
} elseif (in_array($item["verb"], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
|
||||
$message = self::constructLike($item, $owner);
|
||||
$type = "like";
|
||||
} elseif (!in_array($item["verb"], [ACTIVITY_FOLLOW])) {
|
||||
} elseif (!in_array($item["verb"], [ACTIVITY_FOLLOW, ACTIVITY_TAG])) {
|
||||
$message = self::constructComment($item, $owner);
|
||||
$type = "comment";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue