Merge pull request #12103 from MrPetovan/task/4090-move-mod-suggest
Move mod/suggest.php to src/Module
This commit is contained in:
commit
16b3db343b
|
@ -93,7 +93,7 @@ function match_content(App $a)
|
|||
DI::sysmsg()->addInfo(DI::l10n()->t('No matches'));
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('contact/list.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$title' => DI::l10n()->t('Profile Match'),
|
||||
'$contacts' => array_slice($entries, 0, $limit),
|
||||
|
|
|
@ -1,58 +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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Module\Contact as ModuleContact;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
function suggest_content(App $a)
|
||||
{
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
|
||||
}
|
||||
|
||||
$_SESSION['return_path'] = DI::args()->getCommand();
|
||||
|
||||
DI::page()['aside'] .= Widget::findPeople();
|
||||
DI::page()['aside'] .= Widget::follow();
|
||||
|
||||
$contacts = Contact\Relation::getSuggestions(DI::userSession()->getLocalUserId());
|
||||
if (!DBA::isResult($contacts)) {
|
||||
return DI::l10n()->t('No suggestions available. If this is a new site, please try again in 24 hours.');
|
||||
}
|
||||
|
||||
$entries = [];
|
||||
foreach ($contacts as $contact) {
|
||||
$entries[] = ModuleContact::getContactTemplateVars($contact);
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
|
||||
return Renderer::replaceMacros($tpl,[
|
||||
'$title' => DI::l10n()->t('Friend Suggestions'),
|
||||
'$contacts' => $entries,
|
||||
]);
|
||||
}
|
|
@ -132,7 +132,7 @@ class BaseSearch extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
|
||||
$tpl = Renderer::getMarkupTemplate('contact/list.tpl');
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'title' => $header,
|
||||
'$contacts' => $entries,
|
||||
|
|
77
src/Module/Contact/Suggestions.php
Normal file
77
src/Module/Contact/Suggestions.php
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?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\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Module\Contact as ModuleContact;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class Suggestions extends \Friendica\BaseModule
|
||||
{
|
||||
/** @var IHandleUserSessions */
|
||||
private $session;
|
||||
/** @var App\Page */
|
||||
private $page;
|
||||
|
||||
public function __construct(App\Page $page, IHandleUserSessions $session, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
$this->session = $session;
|
||||
$this->page = $page;
|
||||
}
|
||||
|
||||
protected function content(array $request = []): string
|
||||
{
|
||||
if (!$this->session->getLocalUserId()) {
|
||||
throw new HTTPException\ForbiddenException($this->t('Permission denied.'));
|
||||
}
|
||||
|
||||
$this->page['aside'] .= Widget::findPeople();
|
||||
$this->page['aside'] .= Widget::follow();
|
||||
|
||||
$contacts = Contact\Relation::getSuggestions($this->session->getLocalUserId());
|
||||
if (!$contacts) {
|
||||
return $this->t('No suggestions available. If this is a new site, please try again in 24 hours.');
|
||||
}
|
||||
|
||||
$entries = [];
|
||||
foreach ($contacts as $contact) {
|
||||
$entries[] = ModuleContact::getContactTemplateVars($contact);
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('contact/list.tpl');
|
||||
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$title' => $this->t('Friend Suggestions'),
|
||||
'$contacts' => $entries,
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -178,7 +178,7 @@ class Network extends BaseModule
|
|||
} elseif (self::$forumContactId) {
|
||||
$contact = Contact::getById(self::$forumContactId);
|
||||
if (DBA::isResult($contact)) {
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('viewcontact_template.tpl'), [
|
||||
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('contact/list.tpl'), [
|
||||
'contacts' => [ModuleContact::getContactTemplateVars($contact)],
|
||||
'id' => DI::args()->get(0),
|
||||
]) . $o;
|
||||
|
|
|
@ -373,25 +373,26 @@ return [
|
|||
'/compose[/{type}]' => [Module\Item\Compose::class, [R::GET, R::POST]],
|
||||
|
||||
'/contact' => [
|
||||
'[/]' => [Module\Contact::class, [R::GET]],
|
||||
'/{id:\d+}[/]' => [Module\Contact\Profile::class, [R::GET, R::POST]],
|
||||
'[/]' => [Module\Contact::class, [R::GET]],
|
||||
'/{id:\d+}[/]' => [Module\Contact\Profile::class, [R::GET, R::POST]],
|
||||
'/{id:\d+}/{action:block|ignore|update|updateprofile}'
|
||||
=> [Module\Contact\Profile::class, [R::GET]],
|
||||
'/{id:\d+}/advanced' => [Module\Contact\Advanced::class, [R::GET, R::POST]],
|
||||
=> [Module\Contact\Profile::class, [R::GET]],
|
||||
'/{id:\d+}/advanced' => [Module\Contact\Advanced::class, [R::GET, R::POST]],
|
||||
'/{id:\d+}/conversations' => [Module\Contact\Conversations::class, [R::GET]],
|
||||
'/{id:\d+}/contacts[/{type}]' => [Module\Contact\Contacts::class, [R::GET]],
|
||||
'/{id:\d+}/media' => [Module\Contact\Media::class, [R::GET]],
|
||||
'/{id:\d+}/posts' => [Module\Contact\Posts::class, [R::GET]],
|
||||
'/{id:\d+}/revoke' => [Module\Contact\Revoke::class, [R::GET, R::POST]],
|
||||
'/archived' => [Module\Contact::class, [R::GET]],
|
||||
'/batch' => [Module\Contact::class, [R::GET, R::POST]],
|
||||
'/pending' => [Module\Contact::class, [R::GET]],
|
||||
'/blocked' => [Module\Contact::class, [R::GET]],
|
||||
'/hidden' => [Module\Contact::class, [R::GET]],
|
||||
'/ignored' => [Module\Contact::class, [R::GET]],
|
||||
'/hovercard' => [Module\Contact\Hovercard::class, [R::GET]],
|
||||
'/follow' => [Module\Contact\Follow::class, [R::GET, R::POST]],
|
||||
'/unfollow' => [Module\Contact\Unfollow::class, [R::GET, R::POST]],
|
||||
'/{id:\d+}/contacts[/{type}]' => [Module\Contact\Contacts::class, [R::GET]],
|
||||
'/{id:\d+}/media' => [Module\Contact\Media::class, [R::GET]],
|
||||
'/{id:\d+}/posts' => [Module\Contact\Posts::class, [R::GET]],
|
||||
'/{id:\d+}/revoke' => [Module\Contact\Revoke::class, [R::GET, R::POST]],
|
||||
'/archived' => [Module\Contact::class, [R::GET]],
|
||||
'/batch' => [Module\Contact::class, [R::GET, R::POST]],
|
||||
'/blocked' => [Module\Contact::class, [R::GET]],
|
||||
'/follow' => [Module\Contact\Follow::class, [R::GET, R::POST]],
|
||||
'/hidden' => [Module\Contact::class, [R::GET]],
|
||||
'/hovercard' => [Module\Contact\Hovercard::class, [R::GET]],
|
||||
'/ignored' => [Module\Contact::class, [R::GET]],
|
||||
'/pending' => [Module\Contact::class, [R::GET]],
|
||||
'/suggestions' => [Module\Contact\Suggestions::class, [R::GET]],
|
||||
'/unfollow' => [Module\Contact\Unfollow::class, [R::GET, R::POST]],
|
||||
],
|
||||
|
||||
'/credits' => [Module\Credits::class, [R::GET]],
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: 2022.12-dev\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-11-03 22:30-0400\n"
|
||||
"POT-Creation-Date: 2022-11-04 08:00-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -105,10 +105,10 @@ msgstr ""
|
|||
#: mod/item.php:870 mod/message.php:69 mod/message.php:114 mod/notes.php:44
|
||||
#: mod/ostatus_subscribe.php:33 mod/photos.php:159 mod/photos.php:886
|
||||
#: mod/repair_ostatus.php:31 mod/settings.php:40 mod/settings.php:50
|
||||
#: mod/settings.php:156 mod/suggest.php:34 src/Module/Attach.php:56
|
||||
#: src/Module/BaseApi.php:94 src/Module/BaseNotifications.php:98
|
||||
#: src/Module/Contact/Advanced.php:60 src/Module/Contact/Follow.php:86
|
||||
#: src/Module/Contact/Follow.php:158 src/Module/Contact/Unfollow.php:66
|
||||
#: mod/settings.php:156 src/Module/Attach.php:56 src/Module/BaseApi.php:94
|
||||
#: src/Module/BaseNotifications.php:98 src/Module/Contact/Advanced.php:60
|
||||
#: src/Module/Contact/Follow.php:86 src/Module/Contact/Follow.php:158
|
||||
#: src/Module/Contact/Suggestions.php:54 src/Module/Contact/Unfollow.php:66
|
||||
#: src/Module/Contact/Unfollow.php:80 src/Module/Contact/Unfollow.php:112
|
||||
#: src/Module/Delegation.php:118 src/Module/FollowConfirm.php:38
|
||||
#: src/Module/FriendSuggest.php:57 src/Module/Group.php:40
|
||||
|
@ -1323,16 +1323,6 @@ msgstr ""
|
|||
msgid "Move to folder:"
|
||||
msgstr ""
|
||||
|
||||
#: mod/suggest.php:44
|
||||
msgid ""
|
||||
"No suggestions available. If this is a new site, please try again in 24 "
|
||||
"hours."
|
||||
msgstr ""
|
||||
|
||||
#: mod/suggest.php:55 src/Content/Widget.php:83 view/theme/vier/theme.php:201
|
||||
msgid "Friend Suggestions"
|
||||
msgstr ""
|
||||
|
||||
#: src/App.php:490
|
||||
msgid "No system theme config value set."
|
||||
msgstr ""
|
||||
|
@ -2529,6 +2519,11 @@ msgstr ""
|
|||
msgid "Find"
|
||||
msgstr ""
|
||||
|
||||
#: src/Content/Widget.php:83 src/Module/Contact/Suggestions.php:73
|
||||
#: view/theme/vier/theme.php:201
|
||||
msgid "Friend Suggestions"
|
||||
msgstr ""
|
||||
|
||||
#: src/Content/Widget.php:84 view/theme/vier/theme.php:202
|
||||
msgid "Similar Interests"
|
||||
msgstr ""
|
||||
|
@ -7106,6 +7101,12 @@ msgstr ""
|
|||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Contact/Suggestions.php:62
|
||||
msgid ""
|
||||
"No suggestions available. If this is a new site, please try again in 24 "
|
||||
"hours."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Contact/Unfollow.php:98 src/Module/Contact/Unfollow.php:167
|
||||
msgid "You aren't following this contact."
|
||||
msgstr ""
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<div id="viewcontact_wrapper-{{$id}}">
|
||||
{{foreach $contacts as $contact}}
|
||||
{{include file="contact_template.tpl"}}
|
||||
{{include file="contact/entry.tpl"}}
|
||||
{{/foreach}}
|
||||
</div>
|
||||
<div class="clear"></div>
|
|
@ -8,7 +8,7 @@ at the suggest page and also at many other places *}}
|
|||
|
||||
<ul id="viewcontact_wrapper{{if $id}}-{{$id}}{{/if}}" class="viewcontact_wrapper media-list">
|
||||
{{foreach $contacts as $contact}}
|
||||
<li>{{include file="contact_template.tpl"}}</li>
|
||||
<li>{{include file="contact/entry.tpl"}}</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
<div class="clear"></div>
|
|
@ -1,7 +1,7 @@
|
|||
<div id="contact-drop-confirm">
|
||||
<h2 class="heading">{{$l10n.header}}</h2>
|
||||
|
||||
{{include file="contact_template.tpl" no_contacts_checkbox=True}}
|
||||
{{include file="contact/entry.tpl" no_contacts_checkbox=True}}
|
||||
|
||||
{{include file="confirm.tpl"}}
|
||||
|
||||
|
|
|
@ -49,10 +49,10 @@
|
|||
</ul>
|
||||
<div class="clear"></div>
|
||||
<div id="contact-list">
|
||||
{{* format each contact with the contact_template.tpl *}}
|
||||
{{* format each contact with the contact/entry.tpl *}}
|
||||
<ul id="viewcontact_wrapper" class="viewcontact_wrapper media-list">
|
||||
{{foreach $contacts as $contact}}
|
||||
<li>{{include file="contact_template.tpl"}}</li>
|
||||
<li>{{include file="contact/entry.tpl"}}</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
|
||||
<div id="directory-search-end" class="clear"></div>
|
||||
|
||||
{{* format each contact with the contact_template.tpl *}}
|
||||
{{* format each contact with the contact/entry.tpl *}}
|
||||
<ul id="viewcontact_wrapper" class="viewcontact_wrapper media-list">
|
||||
{{foreach $contacts as $contact}}
|
||||
<li>{{include file="contact_template.tpl"}}</li>
|
||||
<li>{{include file="contact/entry.tpl"}}</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
|
||||
{{* The contacts who are already members of the contact group *}}
|
||||
{{foreach $groupeditor.members as $contact}}
|
||||
<li class="members active">{{include file="contact_template.tpl"}}</li>
|
||||
<li class="members active">{{include file="contact/entry.tpl"}}</li>
|
||||
{{/foreach}}
|
||||
|
||||
{{* The contacts who are not members of the contact group *}}
|
||||
{{foreach $groupeditor.contacts as $contact}}
|
||||
<li class="contacts">{{include file="contact_template.tpl"}}</li>
|
||||
<li class="contacts">{{include file="contact/entry.tpl"}}</li>
|
||||
{{/foreach}}
|
||||
|
||||
</ul>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{{if $contacts}}
|
||||
<ul id="viewcontact_wrapper{{if $id}}-{{$id}}{{/if}}" class="viewcontact_wrapper media-list">
|
||||
{{foreach $contacts as $contact}}
|
||||
<li>{{include file="contact_template.tpl"}}</li>
|
||||
<li>{{include file="contact/entry.tpl"}}</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{else}}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<div class="side-link" id="side-directory-link"><a href="{{$nv.global_dir}}" target="extlink">{{$nv.directory}}</a></div>
|
||||
{{* Additional links *}}
|
||||
<div class="side-link" id="side-match-link"><a href="match">{{$nv.similar}}</a></div>
|
||||
<div class="side-link" id="side-suggest-link"><a href="suggest">{{$nv.suggest}}</a></div>
|
||||
<div class="side-link" id="side-suggest-link"><a href="contact/suggestions">{{$nv.suggest}}</a></div>
|
||||
<div class="side-link" id="side-random-profile-link"><a href="randprof" target="extlink">{{$nv.random}}</a></div>
|
||||
|
||||
{{if $nv.inv}}
|
||||
|
|
Loading…
Reference in a new issue