mirror of
https://github.com/friendica/friendica
synced 2025-04-26 05:10:11 +00:00
Merge pull request #11837 from MrPetovan/task/remove-poke
Remove poke feature
This commit is contained in:
commit
a145712f04
28 changed files with 192 additions and 769 deletions
|
@ -256,63 +256,6 @@ class Item
|
|||
if (!empty($item['verb'])) {
|
||||
$xmlhead = '<?xml version="1.0" encoding="UTF-8" ?>';
|
||||
|
||||
if (stristr($item['verb'], Activity::POKE)) {
|
||||
$verb = urldecode(substr($item['verb'], strpos($item['verb'],'#') + 1));
|
||||
if (!$verb) {
|
||||
$this->profiler->stopRecording();
|
||||
return;
|
||||
}
|
||||
if ($item['object-type'] == '' || $item['object-type'] !== Activity\ObjectType::PERSON) {
|
||||
$this->profiler->stopRecording();
|
||||
return;
|
||||
}
|
||||
|
||||
$obj = XML::parseString($xmlhead . $item['object']);
|
||||
|
||||
$Bname = $obj->title;
|
||||
$Blink = $obj->id;
|
||||
$Bphoto = '';
|
||||
|
||||
foreach ($obj->link as $l) {
|
||||
$atts = $l->attributes();
|
||||
switch ($atts['rel']) {
|
||||
case 'alternate': $Blink = $atts['href'];
|
||||
case 'photo': $Bphoto = $atts['href'];
|
||||
}
|
||||
}
|
||||
|
||||
$author = [
|
||||
'uid' => 0,
|
||||
'id' => $item['author-id'],
|
||||
'network' => $item['author-network'],
|
||||
'url' => $item['author-link'],
|
||||
];
|
||||
$A = '[url=' . Contact::magicLinkByContact($author) . ']' . $item['author-name'] . '[/url]';
|
||||
|
||||
if (!empty($Blink)) {
|
||||
$B = '[url=' . Contact::magicLink($Blink) . ']' . $Bname . '[/url]';
|
||||
} else {
|
||||
$B = '';
|
||||
}
|
||||
|
||||
if ($Bphoto != '' && !empty($Blink)) {
|
||||
$Bphoto = '[url=' . Contact::magicLink($Blink) . '][img=80x80]' . $Bphoto . '[/img][/url]';
|
||||
}
|
||||
|
||||
/*
|
||||
* we can't have a translation string with three positions but no distinguishable text
|
||||
* So here is the translate string.
|
||||
*/
|
||||
$txt = $this->l10n->t('%1$s poked %2$s');
|
||||
|
||||
// now translate the verb
|
||||
$poked_t = trim(sprintf($txt, '', ''));
|
||||
$txt = str_replace($poked_t, $this->l10n->t($verb), $txt);
|
||||
|
||||
// then do the sprintf on the translation string
|
||||
$item['body'] = sprintf($txt, $A, $B) . "\n\n\n" . $Bphoto;
|
||||
}
|
||||
|
||||
if ($this->activity->match($item['verb'], Activity::TAG)) {
|
||||
$fields = ['author-id', 'author-link', 'author-name', 'author-network',
|
||||
'verb', 'object-type', 'resource-id', 'body', 'plink'];
|
||||
|
@ -382,7 +325,7 @@ class Item
|
|||
public function photoMenu(array $item, string $formSecurityToken): string
|
||||
{
|
||||
$this->profiler->startRecording('rendering');
|
||||
$sub_link = $poke_link = $contact_url = $pm_url = $status_link = '';
|
||||
$sub_link = $contact_url = $pm_url = $status_link = '';
|
||||
$photos_link = $posts_link = $block_link = $ignore_link = '';
|
||||
|
||||
if (local_user() && local_user() == $item['uid'] && $item['gravity'] == GRAVITY_PARENT && !$item['self'] && !$item['mention']) {
|
||||
|
@ -425,7 +368,6 @@ class Item
|
|||
|
||||
if ($cid && !$item['self']) {
|
||||
$contact_url = 'contact/' . $cid;
|
||||
$poke_link = $contact_url . '/poke';
|
||||
$posts_link = $contact_url . '/posts';
|
||||
|
||||
if (in_array($network, [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA])) {
|
||||
|
@ -450,10 +392,6 @@ class Item
|
|||
$menu[$this->l10n->t('Languages')] = 'javascript:alert(\'' . ModelItem::getLanguageMessage($item) . '\');';
|
||||
}
|
||||
|
||||
if ($network == Protocol::DFRN) {
|
||||
$menu[$this->l10n->t('Poke')] = $poke_link;
|
||||
}
|
||||
|
||||
if ((($cid == 0) || ($rel == Contact::FOLLOWER)) &&
|
||||
in_array($item['network'], Protocol::FEDERATED)) {
|
||||
$menu[$this->l10n->t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']) . '&auto=1';
|
||||
|
|
|
@ -429,32 +429,6 @@ class L10n
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load poke verbs
|
||||
*
|
||||
* @return array index is present tense verb
|
||||
* value is array containing past tense verb, translation of present, translation of past
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @hook poke_verbs pokes array
|
||||
*/
|
||||
public function getPokeVerbs(): array
|
||||
{
|
||||
// index is present tense verb
|
||||
// value is array containing past tense verb, translation of present, translation of past
|
||||
$arr = [
|
||||
'poke' => ['poked', $this->t('poke'), $this->t('poked')],
|
||||
'ping' => ['pinged', $this->t('ping'), $this->t('pinged')],
|
||||
'prod' => ['prodded', $this->t('prod'), $this->t('prodded')],
|
||||
'slap' => ['slapped', $this->t('slap'), $this->t('slapped')],
|
||||
'finger' => ['fingered', $this->t('finger'), $this->t('fingered')],
|
||||
'rebuff' => ['rebuffed', $this->t('rebuff'), $this->t('rebuffed')],
|
||||
];
|
||||
|
||||
Hook::callAll('poke_verbs', $arr);
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new L10n instance based on the given langauge
|
||||
*
|
||||
|
|
|
@ -1041,7 +1041,6 @@ class Contact
|
|||
$pm_url = '';
|
||||
$status_link = '';
|
||||
$photos_link = '';
|
||||
$poke_link = '';
|
||||
|
||||
if ($uid == 0) {
|
||||
$uid = local_user();
|
||||
|
@ -1084,10 +1083,6 @@ class Contact
|
|||
$pm_url = DI::baseUrl() . '/message/new/' . $contact['id'];
|
||||
}
|
||||
|
||||
if (($contact['network'] == Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) {
|
||||
$poke_link = 'contact/' . $contact['id'] . '/poke';
|
||||
}
|
||||
|
||||
$contact_url = DI::baseUrl() . '/contact/' . $contact['id'];
|
||||
|
||||
$posts_link = DI::baseUrl() . '/contact/' . $contact['id'] . '/conversations';
|
||||
|
@ -1122,7 +1117,6 @@ class Contact
|
|||
'network' => [DI::l10n()->t('Network Posts') , $posts_link , false],
|
||||
'edit' => [DI::l10n()->t('View Contact') , $contact_url , false],
|
||||
'pm' => [DI::l10n()->t('Send PM') , $pm_url , false],
|
||||
'poke' => [DI::l10n()->t('Poke') , $poke_link , false],
|
||||
'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link , true],
|
||||
'unfollow'=> [DI::l10n()->t('UnFollow') , $unfollow_link , true],
|
||||
];
|
||||
|
|
|
@ -1085,11 +1085,7 @@ class Item
|
|||
// Check for hashtags in the body and repair or add hashtag links
|
||||
$item['body'] = self::setHashtags($item['body']);
|
||||
|
||||
if (stristr($item['verb'], Activity::POKE)) {
|
||||
$notify_type = Delivery::POKE;
|
||||
} else {
|
||||
$notify_type = Delivery::POST;
|
||||
}
|
||||
$notify_type = Delivery::POST;
|
||||
|
||||
// Filling item related side tables
|
||||
if (!empty($item['attach'])) {
|
||||
|
|
|
@ -40,7 +40,7 @@ class Type
|
|||
const SUGGEST = 32;
|
||||
/** @var int Notification about being tagged in a post */
|
||||
const TAG_SELF = 128;
|
||||
/** @var int Notification about getting poked/prodded/etc. */
|
||||
/** @var int Notification about getting poked/prodded/etc. (Obsolete) */
|
||||
const POKE = 512;
|
||||
/** @var int Notification about either a contact had posted something directly or the contact is a mentioned forum */
|
||||
const SHARE = 1024;
|
||||
|
|
|
@ -1,183 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2022, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Module\Contact;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
class Poke extends BaseModule
|
||||
{
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
if (!local_user() || empty($this->parameters['id'])) {
|
||||
return self::postReturn(false);
|
||||
}
|
||||
|
||||
$uid = local_user();
|
||||
|
||||
if (empty($_POST['verb'])) {
|
||||
return self::postReturn(false);
|
||||
}
|
||||
|
||||
$verb = $_POST['verb'];
|
||||
|
||||
$verbs = DI::l10n()->getPokeVerbs();
|
||||
if (!array_key_exists($verb, $verbs)) {
|
||||
return self::postReturn(false);
|
||||
}
|
||||
|
||||
$activity = Activity::POKE . '#' . urlencode($verbs[$verb][0]);
|
||||
|
||||
$contact_id = intval($this->parameters['id']);
|
||||
if (!$contact_id) {
|
||||
return self::postReturn(false);
|
||||
}
|
||||
|
||||
Logger::info('verb ' . $verb . ' contact ' . $contact_id);
|
||||
|
||||
$contact = DBA::selectFirst('contact', ['id', 'name', 'url', 'photo'], ['id' => $this->parameters['id'], 'uid' => local_user()]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
return self::postReturn(false);
|
||||
}
|
||||
|
||||
$a = DI::app();
|
||||
|
||||
$private = !empty($_POST['private']) ? Model\Item::PRIVATE : Model\Item::PUBLIC;
|
||||
|
||||
$user = Model\User::getById($a->getLoggedInUserId());
|
||||
$allow_cid = ($private ? '<' . $contact['id']. '>' : $user['allow_cid']);
|
||||
$allow_gid = ($private ? '' : $user['allow_gid']);
|
||||
$deny_cid = ($private ? '' : $user['deny_cid']);
|
||||
$deny_gid = ($private ? '' : $user['deny_gid']);
|
||||
|
||||
$actor = Contact::getById($a->getContactId());
|
||||
|
||||
$uri = Model\Item::newURI();
|
||||
|
||||
$arr = [];
|
||||
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uid'] = $uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['wall'] = 1;
|
||||
$arr['contact-id'] = $actor['id'];
|
||||
$arr['owner-name'] = $actor['name'];
|
||||
$arr['owner-link'] = $actor['url'];
|
||||
$arr['owner-avatar'] = $actor['thumb'];
|
||||
$arr['author-name'] = $actor['name'];
|
||||
$arr['author-link'] = $actor['url'];
|
||||
$arr['author-avatar'] = $actor['thumb'];
|
||||
$arr['title'] = '';
|
||||
$arr['allow_cid'] = $allow_cid;
|
||||
$arr['allow_gid'] = $allow_gid;
|
||||
$arr['deny_cid'] = $deny_cid;
|
||||
$arr['deny_gid'] = $deny_gid;
|
||||
$arr['visible'] = 1;
|
||||
$arr['verb'] = $activity;
|
||||
$arr['private'] = $private;
|
||||
$arr['object-type'] = Activity\ObjectType::PERSON;
|
||||
|
||||
$arr['origin'] = 1;
|
||||
$arr['body'] = '@[url=' . $actor['url'] . ']' . $actor['name'] . '[/url]' . ' ' . $verbs[$verb][2] . ' ' . '@[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
||||
|
||||
$arr['object'] = '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . XML::escape($contact['name']) . '</title><id>' . XML::escape($contact['url']) . '</id>';
|
||||
$arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />') . "\n";
|
||||
|
||||
$arr['object'] .= XML::escape('<link rel="photo" type="image/jpeg" href="' . $contact['photo'] . '" />') . "\n";
|
||||
$arr['object'] .= '</link></object>' . "\n";
|
||||
|
||||
$result = Model\Item::insert($arr);
|
||||
|
||||
Hook::callAll('post_local_end', $arr);
|
||||
|
||||
return self::postReturn($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Since post() is called before rawContent(), we need to be able to return a JSON response in post() directly.
|
||||
*
|
||||
* @param bool $success
|
||||
* @return bool
|
||||
*/
|
||||
private static function postReturn(bool $success)
|
||||
{
|
||||
if (!$success) {
|
||||
notice(DI::l10n()->t('Error while sending poke, please retry.'));
|
||||
}
|
||||
|
||||
if (DI::mode()->isAjax()) {
|
||||
System::jsonExit(['success' => $success]);
|
||||
}
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!local_user()) {
|
||||
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.'));
|
||||
}
|
||||
|
||||
if (empty($this->parameters['id'])) {
|
||||
throw new HTTPException\BadRequestException();
|
||||
}
|
||||
|
||||
$contact = DBA::selectFirst('contact', ['id', 'url', 'name'], ['id' => $this->parameters['id'], 'uid' => local_user()]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
throw new HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
DI::page()['aside'] = Widget\VCard::getHTML(Model\Contact::getByURL($contact["url"], false));
|
||||
|
||||
$verbs = [];
|
||||
foreach (DI::l10n()->getPokeVerbs() as $verb => $translations) {
|
||||
if ($translations[1] !== 'NOTRANSLATION') {
|
||||
$verbs[$verb] = $translations[1];
|
||||
}
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('contact/poke.tpl');
|
||||
$o = Renderer::replaceMacros($tpl,[
|
||||
'$title' => DI::l10n()->t('Poke/Prod'),
|
||||
'$desc' => DI::l10n()->t('poke, prod or do other things to somebody'),
|
||||
'$id' => $contact['id'],
|
||||
'$verb' => ['verb', DI::l10n()->t('Choose what you wish to do to recipient'), '', '', $verbs],
|
||||
'$private' => ['private', DI::l10n()->t('Make this post private')],
|
||||
'$loading' => DI::l10n()->t('Loading...'),
|
||||
'$submit' => DI::l10n()->t('Submit'),
|
||||
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
|
@ -617,7 +617,6 @@ class Account extends BaseSettings
|
|||
'$notify5' => ['notify5', DI::l10n()->t('You receive a private message'), ($notify & Notification\Type::MAIL), Notification\Type::MAIL, ''],
|
||||
'$notify6' => ['notify6', DI::l10n()->t('You receive a friend suggestion'), ($notify & Notification\Type::SUGGEST), Notification\Type::SUGGEST, ''],
|
||||
'$notify7' => ['notify7', DI::l10n()->t('You are tagged in a post'), ($notify & Notification\Type::TAG_SELF), Notification\Type::TAG_SELF, ''],
|
||||
'$notify8' => ['notify8', DI::l10n()->t('You are poked/prodded/etc. in a post'), ($notify & Notification\Type::POKE), Notification\Type::POKE, ''],
|
||||
|
||||
'$lbl_notify' => DI::l10n()->t('Create a desktop notification when:'),
|
||||
'$notify_tagged' => ['notify_tagged', DI::l10n()->t('Someone tagged you'), is_null($notify_type) || $notify_type & UserNotification::TYPE_EXPLICIT_TAGGED, ''],
|
||||
|
|
|
@ -358,25 +358,6 @@ class Notify extends BaseRepository
|
|||
$itemlink = $params['link'];
|
||||
break;
|
||||
|
||||
case Model\Notification\Type::POKE:
|
||||
$subject = $l10n->t('%1$s %2$s poked you', $subjectPrefix, $params['source_name']);
|
||||
|
||||
$preamble = $l10n->t('%1$s poked you at %2$s', $params['source_name'], $sitename);
|
||||
$epreamble = $l10n->t('%1$s [url=%2$s]poked you[/url].',
|
||||
'[url='.$params['source_link'].']'.$params['source_name'].'[/url]',
|
||||
$params['link']
|
||||
);
|
||||
|
||||
$subject = str_replace('poked', $l10n->t($params['activity']), $subject);
|
||||
$preamble = str_replace('poked', $l10n->t($params['activity']), $preamble);
|
||||
$epreamble = str_replace('poked', $l10n->t($params['activity']), $epreamble);
|
||||
|
||||
$sitelink = $l10n->t('Please visit %s to view and/or reply to the conversation.');
|
||||
$tsitelink = sprintf($sitelink, $siteurl);
|
||||
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
|
||||
$itemlink = $params['link'];
|
||||
break;
|
||||
|
||||
case Model\Notification\Type::INTRO:
|
||||
$itemlink = $params['link'];
|
||||
$subject = $l10n->t('%s Introduction received', $subjectPrefix);
|
||||
|
|
|
@ -164,15 +164,6 @@ final class Activity
|
|||
*/
|
||||
const ANNOUNCE = ActivityNamespace::ACTIVITY2 . 'Announce';
|
||||
|
||||
/**
|
||||
* Pokes an user.
|
||||
*
|
||||
* @see https://github.com/friendica/friendica/wiki/ActivityStreams#activity_poke
|
||||
* @var string
|
||||
*/
|
||||
const POKE = ActivityNamespace::ZOT . '/activity/poke';
|
||||
|
||||
|
||||
const O_UNFOLLOW = ActivityNamespace::OSTATUS . '/unfollow';
|
||||
const O_UNFAVOURITE = ActivityNamespace::OSTATUS . '/unfavorite';
|
||||
|
||||
|
|
|
@ -103,8 +103,6 @@ class Delivery
|
|||
$success = ActivityPub\Transmitter::sendContactSuggestion($uid, $inbox, $item_id);
|
||||
} elseif ($cmd == WorkerDelivery::RELOCATION) {
|
||||
// @todo Implementation pending
|
||||
} elseif ($cmd == WorkerDelivery::POKE) {
|
||||
// Implementation not planned
|
||||
} elseif ($cmd == WorkerDelivery::REMOVAL) {
|
||||
$success = ActivityPub\Transmitter::sendProfileDeletion($uid, $inbox);
|
||||
} elseif ($cmd == WorkerDelivery::PROFILEUPDATE) {
|
||||
|
|
|
@ -1577,61 +1577,6 @@ class DFRN
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a "poke"
|
||||
*
|
||||
* @param array $item The new item record
|
||||
* @param array $importer Record of the importer user mixed with contact of the content
|
||||
* @return void
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @todo set proper type-hints (array?)
|
||||
*/
|
||||
private static function doPoke(array $item, array $importer)
|
||||
{
|
||||
$verb = urldecode(substr($item['verb'], strpos($item['verb'], '#')+1));
|
||||
if (!$verb) {
|
||||
return;
|
||||
}
|
||||
$xo = XML::parseString($item['object']);
|
||||
|
||||
if (($xo->type == Activity\ObjectType::PERSON) && ($xo->id)) {
|
||||
// somebody was poked/prodded. Was it me?
|
||||
$Blink = '';
|
||||
foreach ($xo->link as $l) {
|
||||
$atts = $l->attributes();
|
||||
switch ($atts['rel']) {
|
||||
case 'alternate':
|
||||
$Blink = $atts['href'];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($Blink && Strings::compareLink($Blink, DI::baseUrl() . '/profile/' . $importer['nickname'])) {
|
||||
$author = DBA::selectFirst('contact', ['id', 'name', 'thumb', 'url'], ['id' => $item['author-id']]);
|
||||
|
||||
$parent = Post::selectFirst(['id'], ['uri' => $item['thr-parent'], 'uid' => $importer['importer_uid']]);
|
||||
$item['parent'] = $parent['id'];
|
||||
|
||||
// send a notification
|
||||
DI::notify()->createFromArray(
|
||||
[
|
||||
'type' => Notification\Type::POKE,
|
||||
'otype' => Notification\ObjectType::PERSON,
|
||||
'activity' => $verb,
|
||||
'verb' => $item['verb'],
|
||||
'uid' => $importer['importer_uid'],
|
||||
'cid' => $author['id'],
|
||||
'item' => $item,
|
||||
'link' => DI::baseUrl() . '/display/' . urlencode($item['guid']),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes several actions, depending on the verb
|
||||
*
|
||||
|
@ -2155,11 +2100,6 @@ class DFRN
|
|||
if ($item['uid'] == 0) {
|
||||
Item::distribute($posted_id);
|
||||
}
|
||||
|
||||
if (stristr($item['verb'], Activity::POKE)) {
|
||||
$item['id'] = $posted_id;
|
||||
self::doPoke($item, $importer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ class Delivery
|
|||
const RELOCATION = 'relocate';
|
||||
const DELETION = 'drop';
|
||||
const POST = 'wall-new';
|
||||
const POKE = 'poke';
|
||||
const REMOVAL = 'removeme';
|
||||
const PROFILEUPDATE = 'profileupdate';
|
||||
|
||||
|
@ -247,7 +246,7 @@ class Delivery
|
|||
*/
|
||||
private static function setFailedQueue(string $cmd, array $item)
|
||||
{
|
||||
if (!in_array($cmd, [Delivery::POST, Delivery::POKE])) {
|
||||
if ($cmd != Delivery::POST) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -326,7 +325,7 @@ class Delivery
|
|||
if ($public_dfrn) {
|
||||
Logger::info('Relay delivery to ' . $contact["url"] . ' with guid ' . $target_item["guid"] . ' returns ' . $deliver_status);
|
||||
|
||||
if (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
|
||||
if ($cmd == Delivery::POST) {
|
||||
if (($deliver_status >= 200) && ($deliver_status <= 299)) {
|
||||
Model\Post\DeliveryData::incrementQueueDone($target_item['uri-id'], $protocol);
|
||||
|
||||
|
@ -356,7 +355,7 @@ class Delivery
|
|||
|
||||
Model\GServer::setProtocol($contact['gsid'] ?? 0, $protocol);
|
||||
|
||||
if (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
|
||||
if ($cmd == Delivery::POST) {
|
||||
Model\Post\DeliveryData::incrementQueueDone($target_item['uri-id'], $protocol);
|
||||
}
|
||||
} else {
|
||||
|
@ -364,7 +363,7 @@ class Delivery
|
|||
Model\Contact::markForArchival($contact);
|
||||
|
||||
Logger::info('Delivery failed: defer message', ['id' => ($target_item['guid'] ?? '') ?: $target_item['id']]);
|
||||
if (!Worker::defer() && in_array($cmd, [Delivery::POST, Delivery::POKE])) {
|
||||
if (!Worker::defer() && $cmd == Delivery::POST) {
|
||||
Model\Post\DeliveryData::incrementQueueFailed($target_item['uri-id']);
|
||||
}
|
||||
}
|
||||
|
@ -443,7 +442,7 @@ class Delivery
|
|||
|
||||
Model\GServer::setProtocol($contact['gsid'] ?? 0, Model\Post\DeliveryData::DIASPORA);
|
||||
|
||||
if (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
|
||||
if ($cmd == Delivery::POST) {
|
||||
Model\Post\DeliveryData::incrementQueueDone($target_item['uri-id'], Model\Post\DeliveryData::DIASPORA);
|
||||
}
|
||||
} else {
|
||||
|
@ -458,10 +457,10 @@ class Delivery
|
|||
if (empty($contact['contact-type']) || ($contact['contact-type'] != Model\Contact::TYPE_RELAY)) {
|
||||
Logger::info('Delivery failed: defer message', ['id' => ($target_item['guid'] ?? '') ?: $target_item['id']]);
|
||||
// defer message for redelivery
|
||||
if (!Worker::defer() && in_array($cmd, [Delivery::POST, Delivery::POKE])) {
|
||||
if (!Worker::defer() && $cmd == Delivery::POST) {
|
||||
Model\Post\DeliveryData::incrementQueueFailed($target_item['uri-id']);
|
||||
}
|
||||
} elseif (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
|
||||
} elseif ($cmd == Delivery::POST) {
|
||||
Model\Post\DeliveryData::incrementQueueFailed($target_item['uri-id']);
|
||||
}
|
||||
}
|
||||
|
@ -490,7 +489,7 @@ class Delivery
|
|||
return;
|
||||
}
|
||||
|
||||
if (!in_array($cmd, [self::POST, self::POKE])) {
|
||||
if ($cmd != self::POST) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -467,7 +467,7 @@ class Notifier
|
|||
Hook::callAll('notifier_end', $target_item);
|
||||
|
||||
// Workaround for pure connector posts
|
||||
if (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
|
||||
if ($cmd == Delivery::POST) {
|
||||
if ($delivery_queue_count == 0) {
|
||||
Post\DeliveryData::incrementQueueDone($target_item['uri-id']);
|
||||
$delivery_queue_count = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue