Rename "forum" to "group"
- This reflects a change in Friendica Core
This commit is contained in:
parent
f854d7d5f7
commit
aade2ec534
|
@ -16,7 +16,7 @@ Accept: application/json
|
|||
```
|
||||
|
||||
URI Parameter:
|
||||
- `account_type` (optional): An arbitrary account type string. Expected values are `all`, `people`, `news`, `organization` and `forum`. Default is `all`.
|
||||
- `account_type` (optional): An arbitrary account type string. Expected values are `all`, `people`, `news`, `organization` and `group`. Default is `all`.
|
||||
Query parameters:
|
||||
- `q`: The search query.
|
||||
- `page` (optional): The page number, default is 1.
|
||||
|
|
|
@ -7,6 +7,13 @@ namespace Friendica\Directory\Models;
|
|||
*/
|
||||
class Profile extends \Friendica\Directory\Model
|
||||
{
|
||||
const ACCOUNT_TYPE_PERSON = 0;
|
||||
const ACCOUNT_TYPE_ORGANISATION = 1;
|
||||
const ACCOUNT_TYPE_NEWS = 2;
|
||||
const ACCOUNT_TYPE_COMMUNITY = 3;
|
||||
const ACCOUNT_TYPE_RELAY = 4;
|
||||
const ACCOUNT_TYPE_DELETED = 127;
|
||||
|
||||
public function deleteById(int $profile_id): bool
|
||||
{
|
||||
$this->atlas->perform('DELETE FROM `photo` WHERE `profile_id` = :profile_id',
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Friendica\Directory\Pollers;
|
||||
|
||||
use Friendica\Directory\Models;
|
||||
use Friendica\Directory\Utils;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
|
||||
/**
|
||||
|
@ -24,12 +26,12 @@ class Profile
|
|||
private $http;
|
||||
|
||||
/**
|
||||
* @var \Friendica\Directory\Models\Server
|
||||
* @var Models\Server
|
||||
*/
|
||||
private $serverModel;
|
||||
|
||||
/**
|
||||
* @var \Friendica\Directory\Models\Profile
|
||||
* @var Models\Profile
|
||||
*/
|
||||
private $profileModel;
|
||||
|
||||
|
@ -49,8 +51,8 @@ class Profile
|
|||
public function __construct(
|
||||
\Atlas\Pdo\Connection $atlas,
|
||||
\GuzzleHttp\ClientInterface $http,
|
||||
\Friendica\Directory\Models\Server $serverModel,
|
||||
\Friendica\Directory\Models\Profile $profileModel,
|
||||
Models\Server $serverModel,
|
||||
Models\Profile $profileModel,
|
||||
\Psr\Log\LoggerInterface $logger,
|
||||
array $settings
|
||||
)
|
||||
|
@ -81,12 +83,12 @@ class Profile
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!\Friendica\Directory\Utils\Network::isPublicHost($host)) {
|
||||
if (!Utils\Network::isPublicHost($host)) {
|
||||
$this->logger->warning('Private/reserved IP in polled profile URL: ' . $profile_uri);
|
||||
return false;
|
||||
}
|
||||
|
||||
$profileUriInfo = \Friendica\Directory\Models\Profile::extractInfoFromProfileUrl($profile_uri);
|
||||
$profileUriInfo = Models\Profile::extractInfoFromProfileUrl($profile_uri);
|
||||
if (!$profileUriInfo) {
|
||||
$this->logger->warning('Profile URI invalid');
|
||||
return false;
|
||||
|
@ -137,7 +139,7 @@ class Profile
|
|||
if ($server['noscrape_url']) {
|
||||
$this->logger->debug('Calling ' . $server['noscrape_url'] . '/' . $username);
|
||||
try {
|
||||
$params = \Friendica\Directory\Utils\Scrape::retrieveNoScrapeData($this->http, $server['noscrape_url'] . '/' . $username);
|
||||
$params = Utils\Scrape::retrieveNoScrapeData($this->http, $server['noscrape_url'] . '/' . $username);
|
||||
} catch (RequestException $e) {
|
||||
$this->logger->info('Request failed with error code ' . $e->getCode());
|
||||
} catch (\Throwable $e) {
|
||||
|
@ -151,7 +153,7 @@ class Profile
|
|||
if (!$available) {
|
||||
$this->logger->info('Parsing profile page ' . $profile_uri);
|
||||
try {
|
||||
$params = \Friendica\Directory\Utils\Scrape::retrieveProfileData($this->http, $profile_uri);
|
||||
$params = Utils\Scrape::retrieveProfileData($this->http, $profile_uri);
|
||||
} catch (RequestException $e) {
|
||||
$this->logger->info('Request failed with error code ' . $e->getCode());
|
||||
} catch (\Throwable $e) {
|
||||
|
@ -209,16 +211,22 @@ class Profile
|
|||
return false;
|
||||
}
|
||||
|
||||
switch ($params['account-type'] ?? 0) {
|
||||
case 1: $account_type = 'News'; break;
|
||||
case 2: $account_type = 'Organization'; break;
|
||||
case 3: $account_type = 'Forum'; break;
|
||||
case 0:
|
||||
default:
|
||||
switch ($params['account-type'] ?? Models\Profile::ACCOUNT_TYPE_PERSON) {
|
||||
case Models\Profile::ACCOUNT_TYPE_ORGANISATION: $account_type = 'Organization'; break;
|
||||
case Models\Profile::ACCOUNT_TYPE_NEWS : $account_type = 'News'; break;
|
||||
case Models\Profile::ACCOUNT_TYPE_COMMUNITY : $account_type = 'Group'; break;
|
||||
case Models\Profile::ACCOUNT_TYPE_RELAY : $account_type = 'Relay'; break;
|
||||
case Models\Profile::ACCOUNT_TYPE_DELETED : $account_type = 'Deleted'; break;
|
||||
|
||||
case Models\Profile::ACCOUNT_TYPE_PERSON: {
|
||||
$account_type = 'People';
|
||||
if (!empty($params['comm'])) {
|
||||
$account_type = 'Forum';
|
||||
$account_type = 'Group';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: $account_type = 'Unknown'; break;
|
||||
}
|
||||
|
||||
$tags = [];
|
||||
|
@ -323,7 +331,7 @@ class Profile
|
|||
if ($profile_id) {
|
||||
try {
|
||||
$img_str = $this->http->get($params['photo'])->getBody()->getContents();
|
||||
$img = new \Friendica\Directory\Utils\Photo($img_str);
|
||||
$img = new Utils\Photo($img_str);
|
||||
if ($img->getImage()) {
|
||||
$img->scaleImageSquare(80);
|
||||
|
||||
|
|
|
@ -56,7 +56,9 @@ class AccountTypeTabs
|
|||
case 'People' : $title = $this->renderer->np__('account-type', 'People (%d)' , 'People (%d)' , $account_type['count']); break;
|
||||
case 'News' : $title = $this->renderer->np__('account-type', 'News (%d)' , 'News (%d)' , $account_type['count']); break;
|
||||
case 'Organization': $title = $this->renderer->np__('account-type', 'Organization (%d)', 'Organizations (%d)', $account_type['count']); break;
|
||||
case 'Forum' : $title = $this->renderer->np__('account-type', 'Forum (%d)' , 'Forums (%d)' , $account_type['count']); break;
|
||||
// Kept for backward compatibility
|
||||
case 'Forum' :
|
||||
case 'Group' : $title = $this->renderer->np__('account-type', 'Group (%d)' , 'Groups (%d)' , $account_type['count']); break;
|
||||
default: $title = $this->renderer->np__('account-type', $account_type['account_type']. ' (%d)', $account_type['account_type']. ' (%d)', $account_type['count']);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,31 +31,31 @@ msgstr ""
|
|||
msgid "Last"
|
||||
msgstr ""
|
||||
|
||||
#: src\classes\Controllers\Web\Directory.php:73
|
||||
#: src\classes\Controllers\Web\Directory.php:85
|
||||
msgid "People"
|
||||
msgstr ""
|
||||
|
||||
#: src\classes\Controllers\Web\Search.php:64
|
||||
#: src\classes\Controllers\Web\Search.php:72
|
||||
msgctxt "field"
|
||||
msgid "Language"
|
||||
msgstr ""
|
||||
|
||||
#: src\classes\Controllers\Web\Search.php:65
|
||||
#: src\classes\Controllers\Web\Search.php:73
|
||||
msgctxt "field"
|
||||
msgid "Locality"
|
||||
msgstr ""
|
||||
|
||||
#: src\classes\Controllers\Web\Search.php:66
|
||||
#: src\classes\Controllers\Web\Search.php:74
|
||||
msgctxt "field"
|
||||
msgid "Region"
|
||||
msgstr ""
|
||||
|
||||
#: src\classes\Controllers\Web\Search.php:67
|
||||
#: src\classes\Controllers\Web\Search.php:75
|
||||
msgctxt "field"
|
||||
msgid "Country"
|
||||
msgstr ""
|
||||
|
||||
#: src\classes\Controllers\Web\Servers.php:90
|
||||
#: src\classes\Controllers\Web\Servers.php:105
|
||||
msgid "Public Servers"
|
||||
msgstr ""
|
||||
|
||||
|
@ -105,11 +105,11 @@ msgid_plural "%d results for \"%s\""
|
|||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: src\templates\servers.phtml:2
|
||||
#: src\templates\servers.phtml:7
|
||||
msgid "Top servers pagination"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\servers.phtml:12
|
||||
#: src\templates\servers.phtml:17
|
||||
msgid "Bottom servers pagination"
|
||||
msgstr ""
|
||||
|
||||
|
@ -126,24 +126,27 @@ msgid "Filter by country"
|
|||
msgstr ""
|
||||
|
||||
#: src\templates\sub\profile.phtml:31
|
||||
#: src\templates\sub\profile.phtml:35
|
||||
#: src\templates\sub\profile.phtml:39
|
||||
msgctxt "verb"
|
||||
msgid "Follow"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\layout.phtml:65
|
||||
#: src\templates\sub\profile.phtml:47
|
||||
#: src\templates\sub\profile.phtml:57
|
||||
msgid "Language"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\sub\profile.phtml:50
|
||||
#: src\templates\sub\profile.phtml:60
|
||||
#: src\templates\widget\popularserverlanguages.phtml:2
|
||||
msgid "Filter by language"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\sub\profile.phtml:56
|
||||
#: src\templates\sub\profile.phtml:66
|
||||
msgid "Location"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\sub\profile.phtml:69
|
||||
#: src\templates\sub\profile.phtml:79
|
||||
msgid "Search Tag"
|
||||
msgstr ""
|
||||
|
||||
|
@ -175,15 +178,15 @@ msgstr ""
|
|||
msgid "Outdated Version"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\sub\server.phtml:72
|
||||
#: src\templates\sub\server.phtml:69
|
||||
msgid "Admin"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\sub\server.phtml:79
|
||||
#: src\templates\sub\server.phtml:76
|
||||
msgid "No description provided"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\sub\server.phtml:82
|
||||
#: src\templates\sub\server.phtml:79
|
||||
msgid "Visit Server"
|
||||
msgstr ""
|
||||
|
||||
|
@ -191,7 +194,7 @@ msgstr ""
|
|||
msgid "Popular Countries"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\widget\popularlanguages.phtml:2
|
||||
#: src\templates\widget\popularprofilelanguages.phtml:2
|
||||
msgid "Popular Languages"
|
||||
msgstr ""
|
||||
|
||||
|
@ -220,13 +223,6 @@ msgid_plural "People (%d)"
|
|||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: src\classes\Views\Widget\AccountTypeTabs.php:59
|
||||
msgctxt "account-type"
|
||||
msgid "Forum (%d)"
|
||||
msgid_plural "Forums (%d)"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: src\templates\layout.phtml:97
|
||||
msgid "Stats"
|
||||
msgstr ""
|
||||
|
@ -332,15 +328,30 @@ msgstr[1] ""
|
|||
msgid "None"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\sub\server.phtml:59
|
||||
#: src\templates\sub\server.phtml:63
|
||||
#: src\templates\sub\server.phtml:58
|
||||
#: src\templates\sub\server.phtml:62
|
||||
msgid "Registration Policy"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\sub\server.phtml:60
|
||||
#: src\templates\sub\server.phtml:59
|
||||
msgid "By Approval"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\sub\server.phtml:64
|
||||
#: src\templates\sub\server.phtml:63
|
||||
msgid "Open"
|
||||
msgstr ""
|
||||
|
||||
#: src\classes\Views\Widget\AccountTypeTabs.php:61
|
||||
msgctxt "account-type"
|
||||
msgid "Group (%d)"
|
||||
msgid_plural "Groups (%d)"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: src\templates\servers.phtml:3
|
||||
msgid "Filtered by language:"
|
||||
msgstr ""
|
||||
|
||||
#: src\templates\servers.phtml:3
|
||||
msgid "Clear language filter"
|
||||
msgstr ""
|
||||
|
|
Loading…
Reference in a new issue