Remove poke feature

This commit is contained in:
Hypolite Petovan 2022-08-09 13:21:42 -04:00
parent 119da8b58b
commit 4a885a13a6
27 changed files with 46 additions and 526 deletions

View file

@ -765,7 +765,7 @@ Identical to [the Twitter Media Object](https://developer.twitter.com/en/docs/tw
<li>64: Unused</li> <li>64: Unused</li>
<li>128: Mention</li> <li>128: Mention</li>
<li>256: Tag added to a post</li> <li>256: Tag added to a post</li>
<li>512: Poke</li> <li>512: Poke (Obsolete)</li>
<li>1024: New post</li> <li>1024: New post</li>
<li>16384: System email</li> <li>16384: System email</li>
<li>32768: System event</li> <li>32768: System event</li>

View file

@ -766,10 +766,6 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
Hook::callAll('home_init', $ret); Hook::callAll('home_init', $ret);
Hook::callAll("home_content", $content); Hook::callAll("home_content", $content);
### mod/poke.php
Hook::callAll('post_local_end', $arr);
### mod/contacts.php ### mod/contacts.php
Hook::callAll('contact_edit_post', $_POST); Hook::callAll('contact_edit_post', $_POST);
@ -967,10 +963,6 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
self::callSingle(self::getApp(), 'hook_fork', $fork_hook, $hookdata); self::callSingle(self::getApp(), 'hook_fork', $fork_hook, $hookdata);
### src/Core/L10n/L10n.php
Hook::callAll('poke_verbs', $arr);
### src/Core/Worker.php ### src/Core/Worker.php
Hook::callAll("proc_run", $arr); Hook::callAll("proc_run", $arr);

View file

@ -285,10 +285,6 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
Hook::callAll('home_init', $ret); Hook::callAll('home_init', $ret);
Hook::callAll("home_content", $content); Hook::callAll("home_content", $content);
### mod/poke.php
Hook::callAll('post_local_end', $arr);
### mod/contacts.php ### mod/contacts.php
Hook::callAll('contact_edit_post', $_POST); Hook::callAll('contact_edit_post', $_POST);
@ -461,10 +457,6 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
self::callSingle(self::getApp(), 'hook_fork', $fork_hook, $hookdata); self::callSingle(self::getApp(), 'hook_fork', $fork_hook, $hookdata);
### src/Core/L10n/L10n.php
Hook::callAll('poke_verbs', $arr);
### src/Core/Worker.php ### src/Core/Worker.php
Hook::callAll("proc_run", $arr); Hook::callAll("proc_run", $arr);

View file

@ -256,63 +256,6 @@ class Item
if (!empty($item['verb'])) { if (!empty($item['verb'])) {
$xmlhead = '<?xml version="1.0" encoding="UTF-8" ?>'; $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)) { if ($this->activity->match($item['verb'], Activity::TAG)) {
$fields = ['author-id', 'author-link', 'author-name', 'author-network', $fields = ['author-id', 'author-link', 'author-name', 'author-network',
'verb', 'object-type', 'resource-id', 'body', 'plink']; 'verb', 'object-type', 'resource-id', 'body', 'plink'];
@ -382,7 +325,7 @@ class Item
public function photoMenu(array $item, string $formSecurityToken): string public function photoMenu(array $item, string $formSecurityToken): string
{ {
$this->profiler->startRecording('rendering'); $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 = ''; $photos_link = $posts_link = $block_link = $ignore_link = '';
if (local_user() && local_user() == $item['uid'] && $item['gravity'] == GRAVITY_PARENT && !$item['self'] && !$item['mention']) { 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']) { if ($cid && !$item['self']) {
$contact_url = 'contact/' . $cid; $contact_url = 'contact/' . $cid;
$poke_link = $contact_url . '/poke';
$posts_link = $contact_url . '/posts'; $posts_link = $contact_url . '/posts';
if (in_array($network, [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA])) { 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) . '\');'; $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)) && if ((($cid == 0) || ($rel == Contact::FOLLOWER)) &&
in_array($item['network'], Protocol::FEDERATED)) { in_array($item['network'], Protocol::FEDERATED)) {
$menu[$this->l10n->t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']) . '&auto=1'; $menu[$this->l10n->t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']) . '&auto=1';

View file

@ -429,32 +429,6 @@ class L10n
return $ret; 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 * Creates a new L10n instance based on the given langauge
* *

View file

@ -1041,7 +1041,6 @@ class Contact
$pm_url = ''; $pm_url = '';
$status_link = ''; $status_link = '';
$photos_link = ''; $photos_link = '';
$poke_link = '';
if ($uid == 0) { if ($uid == 0) {
$uid = local_user(); $uid = local_user();
@ -1084,10 +1083,6 @@ class Contact
$pm_url = DI::baseUrl() . '/message/new/' . $contact['id']; $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']; $contact_url = DI::baseUrl() . '/contact/' . $contact['id'];
$posts_link = DI::baseUrl() . '/contact/' . $contact['id'] . '/conversations'; $posts_link = DI::baseUrl() . '/contact/' . $contact['id'] . '/conversations';
@ -1122,7 +1117,6 @@ class Contact
'network' => [DI::l10n()->t('Network Posts') , $posts_link , false], 'network' => [DI::l10n()->t('Network Posts') , $posts_link , false],
'edit' => [DI::l10n()->t('View Contact') , $contact_url , false], 'edit' => [DI::l10n()->t('View Contact') , $contact_url , false],
'pm' => [DI::l10n()->t('Send PM') , $pm_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], 'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link , true],
'unfollow'=> [DI::l10n()->t('UnFollow') , $unfollow_link , true], 'unfollow'=> [DI::l10n()->t('UnFollow') , $unfollow_link , true],
]; ];

View file

@ -1085,11 +1085,7 @@ class Item
// Check for hashtags in the body and repair or add hashtag links // Check for hashtags in the body and repair or add hashtag links
$item['body'] = self::setHashtags($item['body']); $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 // Filling item related side tables
if (!empty($item['attach'])) { if (!empty($item['attach'])) {

View file

@ -40,7 +40,7 @@ class Type
const SUGGEST = 32; const SUGGEST = 32;
/** @var int Notification about being tagged in a post */ /** @var int Notification about being tagged in a post */
const TAG_SELF = 128; const TAG_SELF = 128;
/** @var int Notification about getting poked/prodded/etc. */ /** @var int Notification about getting poked/prodded/etc. (Obsolete) */
const POKE = 512; const POKE = 512;
/** @var int Notification about either a contact had posted something directly or the contact is a mentioned forum */ /** @var int Notification about either a contact had posted something directly or the contact is a mentioned forum */
const SHARE = 1024; const SHARE = 1024;

View file

@ -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;
}
}

View file

@ -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, ''], '$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, ''], '$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, ''], '$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:'), '$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, ''], '$notify_tagged' => ['notify_tagged', DI::l10n()->t('Someone tagged you'), is_null($notify_type) || $notify_type & UserNotification::TYPE_EXPLICIT_TAGGED, ''],

View file

@ -358,25 +358,6 @@ class Notify extends BaseRepository
$itemlink = $params['link']; $itemlink = $params['link'];
break; 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: case Model\Notification\Type::INTRO:
$itemlink = $params['link']; $itemlink = $params['link'];
$subject = $l10n->t('%s Introduction received', $subjectPrefix); $subject = $l10n->t('%s Introduction received', $subjectPrefix);

View file

@ -164,15 +164,6 @@ final class Activity
*/ */
const ANNOUNCE = ActivityNamespace::ACTIVITY2 . 'Announce'; 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_UNFOLLOW = ActivityNamespace::OSTATUS . '/unfollow';
const O_UNFAVOURITE = ActivityNamespace::OSTATUS . '/unfavorite'; const O_UNFAVOURITE = ActivityNamespace::OSTATUS . '/unfavorite';

View file

@ -103,8 +103,6 @@ class Delivery
$success = ActivityPub\Transmitter::sendContactSuggestion($uid, $inbox, $item_id); $success = ActivityPub\Transmitter::sendContactSuggestion($uid, $inbox, $item_id);
} elseif ($cmd == WorkerDelivery::RELOCATION) { } elseif ($cmd == WorkerDelivery::RELOCATION) {
// @todo Implementation pending // @todo Implementation pending
} elseif ($cmd == WorkerDelivery::POKE) {
// Implementation not planned
} elseif ($cmd == WorkerDelivery::REMOVAL) { } elseif ($cmd == WorkerDelivery::REMOVAL) {
$success = ActivityPub\Transmitter::sendProfileDeletion($uid, $inbox); $success = ActivityPub\Transmitter::sendProfileDeletion($uid, $inbox);
} elseif ($cmd == WorkerDelivery::PROFILEUPDATE) { } elseif ($cmd == WorkerDelivery::PROFILEUPDATE) {

View file

@ -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 * Processes several actions, depending on the verb
* *
@ -2155,11 +2100,6 @@ class DFRN
if ($item['uid'] == 0) { if ($item['uid'] == 0) {
Item::distribute($posted_id); Item::distribute($posted_id);
} }
if (stristr($item['verb'], Activity::POKE)) {
$item['id'] = $posted_id;
self::doPoke($item, $importer);
}
} }
} }

View file

@ -45,7 +45,6 @@ class Delivery
const RELOCATION = 'relocate'; const RELOCATION = 'relocate';
const DELETION = 'drop'; const DELETION = 'drop';
const POST = 'wall-new'; const POST = 'wall-new';
const POKE = 'poke';
const REMOVAL = 'removeme'; const REMOVAL = 'removeme';
const PROFILEUPDATE = 'profileupdate'; const PROFILEUPDATE = 'profileupdate';
@ -247,7 +246,7 @@ class Delivery
*/ */
private static function setFailedQueue(string $cmd, array $item) private static function setFailedQueue(string $cmd, array $item)
{ {
if (!in_array($cmd, [Delivery::POST, Delivery::POKE])) { if ($cmd != Delivery::POST) {
return; return;
} }
@ -326,7 +325,7 @@ class Delivery
if ($public_dfrn) { if ($public_dfrn) {
Logger::info('Relay delivery to ' . $contact["url"] . ' with guid ' . $target_item["guid"] . ' returns ' . $deliver_status); 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)) { if (($deliver_status >= 200) && ($deliver_status <= 299)) {
Model\Post\DeliveryData::incrementQueueDone($target_item['uri-id'], $protocol); Model\Post\DeliveryData::incrementQueueDone($target_item['uri-id'], $protocol);
@ -356,7 +355,7 @@ class Delivery
Model\GServer::setProtocol($contact['gsid'] ?? 0, $protocol); 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); Model\Post\DeliveryData::incrementQueueDone($target_item['uri-id'], $protocol);
} }
} else { } else {
@ -364,7 +363,7 @@ class Delivery
Model\Contact::markForArchival($contact); Model\Contact::markForArchival($contact);
Logger::info('Delivery failed: defer message', ['id' => ($target_item['guid'] ?? '') ?: $target_item['id']]); 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']); Model\Post\DeliveryData::incrementQueueFailed($target_item['uri-id']);
} }
} }
@ -443,7 +442,7 @@ class Delivery
Model\GServer::setProtocol($contact['gsid'] ?? 0, Model\Post\DeliveryData::DIASPORA); 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); Model\Post\DeliveryData::incrementQueueDone($target_item['uri-id'], Model\Post\DeliveryData::DIASPORA);
} }
} else { } else {
@ -458,10 +457,10 @@ class Delivery
if (empty($contact['contact-type']) || ($contact['contact-type'] != Model\Contact::TYPE_RELAY)) { 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']]); Logger::info('Delivery failed: defer message', ['id' => ($target_item['guid'] ?? '') ?: $target_item['id']]);
// defer message for redelivery // 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']); 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']); Model\Post\DeliveryData::incrementQueueFailed($target_item['uri-id']);
} }
} }
@ -490,7 +489,7 @@ class Delivery
return; return;
} }
if (!in_array($cmd, [self::POST, self::POKE])) { if ($cmd != self::POST) {
return; return;
} }

View file

@ -467,7 +467,7 @@ class Notifier
Hook::callAll('notifier_end', $target_item); Hook::callAll('notifier_end', $target_item);
// Workaround for pure connector posts // Workaround for pure connector posts
if (in_array($cmd, [Delivery::POST, Delivery::POKE])) { if ($cmd == Delivery::POST) {
if ($delivery_queue_count == 0) { if ($delivery_queue_count == 0) {
Post\DeliveryData::incrementQueueDone($target_item['uri-id']); Post\DeliveryData::incrementQueueDone($target_item['uri-id']);
$delivery_queue_count = 1; $delivery_queue_count = 1;

View file

@ -372,7 +372,6 @@ return [
'/{id:\d+}/conversations' => [Module\Contact\Conversations::class, [R::GET]], '/{id:\d+}/conversations' => [Module\Contact\Conversations::class, [R::GET]],
'/{id:\d+}/contacts[/{type}]' => [Module\Contact\Contacts::class, [R::GET]], '/{id:\d+}/contacts[/{type}]' => [Module\Contact\Contacts::class, [R::GET]],
'/{id:\d+}/media' => [Module\Contact\Media::class, [R::GET]], '/{id:\d+}/media' => [Module\Contact\Media::class, [R::GET]],
'/{id:\d+}/poke' => [Module\Contact\Poke::class, [R::GET, R::POST]],
'/{id:\d+}/posts' => [Module\Contact\Posts::class, [R::GET]], '/{id:\d+}/posts' => [Module\Contact\Posts::class, [R::GET]],
'/{id:\d+}/revoke' => [Module\Contact\Revoke::class, [R::GET, R::POST]], '/{id:\d+}/revoke' => [Module\Contact\Revoke::class, [R::GET, R::POST]],
'/archived' => [Module\Contact::class, [R::GET]], '/archived' => [Module\Contact::class, [R::GET]],

View file

@ -1,11 +0,0 @@
<h2 class="heading">{{$title}}</h2>
<p>{{$desc nofilter}}</p>
<form id="poke-wrapper" action="contact/{{$id}}/poke" method="post">
{{include file="field_select.tpl" field=$verb}}
{{include file="field_checkbox.tpl" field=$private}}
<p class="text-right">
<button type="submit" class="btn btn-primary" name="submit" value="{{$submit}}" data-loading-text="{{$loading}}">{{$submit}}</button>
</p>
</form>

View file

@ -18,11 +18,10 @@
</div> </div>
<div class="hover-card-actions right-aligned"> <div class="hover-card-actions right-aligned">
{{* here are the differnt actions like privat message, poke, delete and so on *}} {{* here are the different actions like private message, delete and so on *}}
{{* @todo we have two different photo menus one for contacts and one for items at the network stream. We currently use the contact photo menu, so the items options are missing We need to move them *}} {{* @todo we have two different photo menus one for contacts and one for items at the network stream. We currently use the contact photo menu, so the items options are missing We need to move them *}}
<div class="hover-card-actions-social"> <div class="hover-card-actions-social">
{{if $profile.actions.pm}}<a class="btn btn-labeled btn-primary btn-sm add-to-modal" href="{{$profile.actions.pm.1}}" aria-label="{{$profile.actions.pm.0}}"><i class="fa fa-envelope" aria-hidden="true" title="{{$profile.actions.pm.0}}"></i><span class="sr-only">{{$profile.actions.pm.0}}</span></a>{{/if}} {{if $profile.actions.pm}}<a class="btn btn-labeled btn-primary btn-sm add-to-modal" href="{{$profile.actions.pm.1}}" aria-label="{{$profile.actions.pm.0}}"><i class="fa fa-envelope" aria-hidden="true" title="{{$profile.actions.pm.0}}"></i><span class="sr-only">{{$profile.actions.pm.0}}</span></a>{{/if}}
{{if $profile.actions.poke}}<a class="btn btn-labeled btn-primary btn-sm add-to-modal" href="{{$profile.actions.poke.1}}" aria-label="{{$profile.actions.poke.0}}"><i class="fa fa-heartbeat" aria-hidden="true" title="{{$profile.actions.poke.0}}"></i><span class="sr-only">{{$profile.actions.poke.0}}</span></a>{{/if}}
</div> </div>
<div class="hover-card-actions-connection"> <div class="hover-card-actions-connection">
{{if $profile.actions.network}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.network.1}}" aria-label="{{$profile.actions.network.0}}" title="{{$profile.actions.network.0}}"><i class="fa fa-cloud" aria-hidden="true"></i></a>{{/if}} {{if $profile.actions.network}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.network.1}}" aria-label="{{$profile.actions.network.0}}" title="{{$profile.actions.network.0}}"><i class="fa fa-cloud" aria-hidden="true"></i></a>{{/if}}

View file

@ -101,7 +101,6 @@
{{include file="field_intcheckbox.tpl" field=$notify5}} {{include file="field_intcheckbox.tpl" field=$notify5}}
{{include file="field_intcheckbox.tpl" field=$notify6}} {{include file="field_intcheckbox.tpl" field=$notify6}}
{{include file="field_intcheckbox.tpl" field=$notify7}} {{include file="field_intcheckbox.tpl" field=$notify7}}
{{include file="field_intcheckbox.tpl" field=$notify8}}
</div> </div>
<div id="settings-notify-desc">{{$lbl_notify}}</div> <div id="settings-notify-desc">{{$lbl_notify}}</div>

View file

@ -443,23 +443,6 @@ $(document).ready(function () {
}); });
}); });
$body.on("submit", ".modal-body #poke-wrapper", function (e) {
e.preventDefault();
let $form = $(this);
let $pokeSubmit = $form.find("button[type=submit]").button("loading");
$.post($form.attr("action"), $form.serialize(), "json")
.then(function (data) {
if (data.success) {
$("#modal").modal("hide");
}
})
.always(function () {
$pokeSubmit.button("reset");
});
});
if (!navigator.canShare || !navigator.canShare()) { if (!navigator.canShare || !navigator.canShare()) {
$('.button-browser-share').hide(); $('.button-browser-share').hide();
} }

View file

@ -68,16 +68,16 @@ function is_modal() {
} }
/** /**
* Array with modalpages * Array with modal pages
* *
* The array contains the page names of the pages * The array contains the page names of the pages
* which should displayed as modals * which should displayed as modals
* *
* @return array Pagenames as path * @return array Page names as path
*/ */
function get_modalpage_list() { function get_modalpage_list() {
//Arry of pages wich getting bootstrap modal dialogs //Array of pages which getting bootstrap modal dialogs
$modalpages = ['poke/', $modalpages = [
'message/new', 'message/new',
'settings/oauth/add', 'settings/oauth/add',
'events/new', 'events/new',

View file

@ -50,11 +50,6 @@
<i class="fa fa-envelope" aria-hidden="true"></i> <i class="fa fa-envelope" aria-hidden="true"></i>
</button> </button>
{{/if}} {{/if}}
{{if $contact.photo_menu.poke}}
<button type="button" class="contact-action-link btn-link" onclick="addToModal('{{$contact.photo_menu.poke.1}}'); return false;" data-toggle="tooltip" title="{{$contact.photo_menu.poke.0}}">
<i class="fa fa-heartbeat" aria-hidden="true"></i>
</button>
{{/if}}
{{if $contact.photo_menu.network}} {{if $contact.photo_menu.network}}
<a class="contact-action-link btn-link" href="{{$contact.photo_menu.network.1}}" data-toggle="tooltip" title="{{$contact.photo_menu.network.0}}"> <a class="contact-action-link btn-link" href="{{$contact.photo_menu.network.1}}" data-toggle="tooltip" title="{{$contact.photo_menu.network.0}}">
<i class="fa fa-cloud" aria-hidden="true"></i> <i class="fa fa-cloud" aria-hidden="true"></i>
@ -178,11 +173,6 @@ We use this part to filter the contacts with jquery.textcomplete *}}
<i class="fa fa-envelope" aria-hidden="true"></i> <i class="fa fa-envelope" aria-hidden="true"></i>
</button> </button>
{/if} {/if}
{if $photo_menu.poke}
<button type="button" class="contact-action-link btn-link" onclick="addToModal('{$photo_menu.poke.1}')" data-toggle="tooltip" title="{$photo_menu.poke.0}">
<i class="fa fa-heartbeat" aria-hidden="true"></i>
</button>
{/if}
{if $photo_menu.network} {if $photo_menu.network}
<a class="contact-action-link btn-link" href="{$photo_menu.network.1}" data-toggle="tooltip" title="{$photo_menu.network.0}"> <a class="contact-action-link btn-link" href="{$photo_menu.network.1}" data-toggle="tooltip" title="{$photo_menu.network.0}">
<i class="fa fa-cloud" aria-hidden="true"></i> <i class="fa fa-cloud" aria-hidden="true"></i>

View file

@ -1,48 +0,0 @@
<div id="poke-wrapper">
<h3 class="heading">{{$title}}</h3>
<div id="poke-desc">{{$desc nofilter}}</div>
<form id="poke-form" action="poke" method="get">
<div id="poke-content-wrapper">
{{* The input field with the recipient name*}}
<div id="poke-recip-wrapper" class="form-group">
<label for="poke-recip">{{$clabel}}</label>
<input id="poke-recip" class="form-control" type="text" size="64" maxlength="255" value="{{$name}}" name="pokename" autocomplete="off" />
<input id="poke-recip-complete" type="hidden" value="{{$id}}" name="cid" />
<input id="poke-parent" type="hidden" value="{{$parent}}" name="parent" />
</div>
{{* The drop-down list with different actions *}}
<div id="poke-action-wrapper" class="form-group">
<label for="poke-verb-select">{{$choice}}</label>
<select name="verb" id="poke-verb-select" class="form-control">
{{foreach $verbs as $v}}
<option value="{{$v.0}}">{{$v.1}}</option>
{{/foreach}}
</select>
</div>
{{* The checkbox to select if the "poke message" should be private *}}
<div id="poke-private-desc" class="checkbox">
<input type="checkbox" id=poke-private-desc-checkbox" name="private" {{if $parent}}disabled="disabled"{{/if}} value="1" />
<label for="poke-private-desc-checkbox">{{$prv_desc}}</label>
</div>
</div>
<div id="poke-content-wrapper-end"></div>
<div id="poke-submit-wrapper">
<button class="btn btn-primary pull-right" type="submit" name="submit" value="{{$submit}}"><i class="fa fa-slideshare"></i>&nbsp;{{$submit}}</button>
</div>
<div id="poke-submit-wrapper-end"></div>
</form>
<div id="poke-wrapper-end"></div>
</div>

View file

@ -152,7 +152,6 @@
{{include file="field_intcheckbox.tpl" field=$notify5}} {{include file="field_intcheckbox.tpl" field=$notify5}}
{{include file="field_intcheckbox.tpl" field=$notify6}} {{include file="field_intcheckbox.tpl" field=$notify6}}
{{include file="field_intcheckbox.tpl" field=$notify7}} {{include file="field_intcheckbox.tpl" field=$notify7}}
{{include file="field_intcheckbox.tpl" field=$notify8}}
</div> </div>
<div id="settings-notify-desc">{{$lbl_notify}}</div> <div id="settings-notify-desc">{{$lbl_notify}}</div>

View file

@ -1,10 +1,26 @@
<?php <?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/>.
*
* Name: frio * Name: frio
* Description: Bootstrap V3 theme. The theme is currently under construction, so it is far from finished. For further information have a look at the <a href="https://github.com/friendica/friendica/tree/develop/view/theme/frio/README.md">ReadMe</a>. * Description: Bootstrap V3 theme. The theme is currently under construction, so it is far from finished. For further information have a look at the <a href="https://github.com/friendica/friendica/tree/develop/view/theme/frio/README.md">ReadMe</a>.
* Version: V.0.8.5 * Version: V.0.8.5
* Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus> * Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus>
*
*/ */
use Friendica\App; use Friendica\App;
@ -105,7 +121,7 @@ function frio_item_photo_links(App $a, &$body_info)
/** /**
* Replace links of the item_photo_menu hook * Replace links of the item_photo_menu hook
* *
* This function replaces the original poke and the message links * This function replaces the original message links
* to call the addToModal javascript function so this pages can * to call the addToModal javascript function so this pages can
* be loaded in a bootstrap modal * be loaded in a bootstrap modal
* *
@ -115,7 +131,7 @@ function frio_item_photo_links(App $a, &$body_info)
function frio_item_photo_menu(App $a, &$arr) function frio_item_photo_menu(App $a, &$arr)
{ {
foreach ($arr['menu'] as $k => $v) { foreach ($arr['menu'] as $k => $v) {
if (strpos($v, '/poke') === 0 || strpos($v, 'message/new/') === 0) { if (strpos($v, 'message/new/') === 0) {
$v = 'javascript:addToModal(\'' . $v . '\'); return false;'; $v = 'javascript:addToModal(\'' . $v . '\'); return false;';
$arr['menu'][$k] = $v; $arr['menu'][$k] = $v;
} }
@ -125,7 +141,7 @@ function frio_item_photo_menu(App $a, &$arr)
/** /**
* Replace links of the contact_photo_menu * Replace links of the contact_photo_menu
* *
* This function replaces the original poke and the message links * This function replaces the original message link
* to call the addToModal javascript function so this pages can * to call the addToModal javascript function so this pages can
* be loaded in a bootstrap modal * be loaded in a bootstrap modal
* Additionally the profile, status and photo page links will be changed * Additionally the profile, status and photo page links will be changed
@ -138,13 +154,7 @@ function frio_contact_photo_menu(App $a, &$args)
{ {
$cid = $args['contact']['id']; $cid = $args['contact']['id'];
if (!empty($args['menu']['poke'])) { if (!empty($args['menu']['pm'])) {
$pokelink = $args['menu']['poke'][1];
} else {
$pokelink = '';
}
if (!empty($args['menu']['poke'])) {
$pmlink = $args['menu']['pm'][1]; $pmlink = $args['menu']['pm'][1];
} else { } else {
$pmlink = ''; $pmlink = '';
@ -166,13 +176,9 @@ function frio_contact_photo_menu(App $a, &$args)
} }
} }
// Add to pm and poke links a new key with the value 'modal'. // Add to pm link a new key with the value 'modal'.
// Later we can make conditions in the corresponing templates (e.g. // Later we can make conditions in the corresponding templates (e.g.
// contact_template.tpl) // contact_template.tpl)
if (strpos($pokelink, $cid . '/poke') !== false) {
$args['menu']['poke'][3] = 'modal';
}
if (strpos($pmlink, 'message/new/' . $cid) !== false) { if (strpos($pmlink, 'message/new/' . $cid) !== false) {
$args['menu']['pm'][3] = 'modal'; $args['menu']['pm'][3] = 'modal';
} }

View file

@ -2721,13 +2721,6 @@ margin-left: 0px;
border: 1px solid #7C7D7B; border: 1px solid #7C7D7B;
} }
/* ========== */
/* = Poke = */
/* ========== */
#poke-recip {
float: none;
}
/* ================= */ /* ================= */
/* = Notifications = */ /* = Notifications = */
/* ================= */ /* ================= */