From 5670c19d5c9ffe1a067210160daf32fd5c84edb5 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 22 Jan 2020 23:14:14 -0500 Subject: [PATCH 1/5] Move/rename base module classes --- src/Module/Admin/Addons/Details.php | 4 ++-- src/Module/Admin/Addons/Index.php | 4 ++-- src/Module/Admin/Blocklist/Contact.php | 4 ++-- src/Module/Admin/Blocklist/Server.php | 4 ++-- src/Module/Admin/DBSync.php | 4 ++-- src/Module/Admin/Features.php | 4 ++-- src/Module/Admin/Federation.php | 4 ++-- src/Module/Admin/Item/Delete.php | 4 ++-- src/Module/Admin/Item/Source.php | 4 ++-- src/Module/Admin/Logs/Settings.php | 4 ++-- src/Module/Admin/Logs/View.php | 4 ++-- src/Module/Admin/PhpInfo.php | 4 ++-- src/Module/Admin/Queue.php | 4 ++-- src/Module/Admin/Site.php | 4 ++-- src/Module/Admin/Summary.php | 4 ++-- src/Module/Admin/Themes/Details.php | 4 ++-- src/Module/Admin/Themes/Embed.php | 4 ++-- src/Module/Admin/Themes/Index.php | 4 ++-- src/Module/Admin/Tos.php | 4 ++-- src/Module/Admin/Users.php | 4 ++-- src/Module/{BaseAdminModule.php => BaseAdmin.php} | 2 +- src/Module/{BaseSearchModule.php => BaseSearch.php} | 2 +- src/Module/{BaseSettingsModule.php => BaseSettings.php} | 2 +- src/Module/Search/Directory.php | 4 ++-- src/Module/Search/Index.php | 4 ++-- src/Module/Settings/Delegation.php | 4 ++-- src/Module/Settings/Profile/Index.php | 4 ++-- src/Module/Settings/Profile/Photo/Crop.php | 4 ++-- src/Module/Settings/Profile/Photo/Index.php | 4 ++-- src/Module/Settings/TwoFactor/AppSpecific.php | 4 ++-- src/Module/Settings/TwoFactor/Index.php | 4 ++-- src/Module/Settings/TwoFactor/Recovery.php | 4 ++-- src/Module/Settings/TwoFactor/Verify.php | 4 ++-- src/Module/Settings/UserExport.php | 4 ++-- 34 files changed, 65 insertions(+), 65 deletions(-) rename src/Module/{BaseAdminModule.php => BaseAdmin.php} (98%) rename src/Module/{BaseSearchModule.php => BaseSearch.php} (99%) rename src/Module/{BaseSettingsModule.php => BaseSettings.php} (98%) diff --git a/src/Module/Admin/Addons/Details.php b/src/Module/Admin/Addons/Details.php index ebf87deda4..94d31b65a6 100644 --- a/src/Module/Admin/Addons/Details.php +++ b/src/Module/Admin/Addons/Details.php @@ -6,10 +6,10 @@ use Friendica\Content\Text\Markdown; use Friendica\Core\Addon; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Util\Strings; -class Details extends BaseAdminModule +class Details extends BaseAdmin { public static function post(array $parameters = []) { diff --git a/src/Module/Admin/Addons/Index.php b/src/Module/Admin/Addons/Index.php index 634bd08c70..74bd61b5fd 100644 --- a/src/Module/Admin/Addons/Index.php +++ b/src/Module/Admin/Addons/Index.php @@ -5,9 +5,9 @@ namespace Friendica\Module\Admin\Addons; use Friendica\Core\Addon; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; -class Index extends BaseAdminModule +class Index extends BaseAdmin { public static function content(array $parameters = []) { diff --git a/src/Module/Admin/Blocklist/Contact.php b/src/Module/Admin/Blocklist/Contact.php index 8eaf418a85..871a7ea747 100644 --- a/src/Module/Admin/Blocklist/Contact.php +++ b/src/Module/Admin/Blocklist/Contact.php @@ -6,10 +6,10 @@ use Friendica\Content\Pager; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Model; -class Contact extends BaseAdminModule +class Contact extends BaseAdmin { public static function post(array $parameters = []) { diff --git a/src/Module/Admin/Blocklist/Server.php b/src/Module/Admin/Blocklist/Server.php index 6c07885993..971b890474 100644 --- a/src/Module/Admin/Blocklist/Server.php +++ b/src/Module/Admin/Blocklist/Server.php @@ -4,10 +4,10 @@ namespace Friendica\Module\Admin\Blocklist; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Util\Strings; -class Server extends BaseAdminModule +class Server extends BaseAdmin { public static function post(array $parameters = []) { diff --git a/src/Module/Admin/DBSync.php b/src/Module/Admin/DBSync.php index c342db93b4..eb7c84c9ba 100644 --- a/src/Module/Admin/DBSync.php +++ b/src/Module/Admin/DBSync.php @@ -7,9 +7,9 @@ use Friendica\Core\Update; use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; -class DBSync extends BaseAdminModule +class DBSync extends BaseAdmin { public static function content(array $parameters = []) { diff --git a/src/Module/Admin/Features.php b/src/Module/Admin/Features.php index ed5abec95a..5e1c3df20e 100644 --- a/src/Module/Admin/Features.php +++ b/src/Module/Admin/Features.php @@ -5,9 +5,9 @@ namespace Friendica\Module\Admin; use Friendica\Content\Feature; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; -class Features extends BaseAdminModule +class Features extends BaseAdmin { public static function post(array $parameters = []) { diff --git a/src/Module/Admin/Federation.php b/src/Module/Admin/Federation.php index 0d83cc41a1..f5e38f0d2d 100644 --- a/src/Module/Admin/Federation.php +++ b/src/Module/Admin/Federation.php @@ -5,9 +5,9 @@ namespace Friendica\Module\Admin; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; -class Federation extends BaseAdminModule +class Federation extends BaseAdmin { public static function content(array $parameters = []) { diff --git a/src/Module/Admin/Item/Delete.php b/src/Module/Admin/Item/Delete.php index 1d7e459a27..424fef2b52 100644 --- a/src/Module/Admin/Item/Delete.php +++ b/src/Module/Admin/Item/Delete.php @@ -5,10 +5,10 @@ namespace Friendica\Module\Admin\Item; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Model\Item; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Util\Strings; -class Delete extends BaseAdminModule +class Delete extends BaseAdmin { public static function post(array $parameters = []) { diff --git a/src/Module/Admin/Item/Source.php b/src/Module/Admin/Item/Source.php index d4666b27f8..a3f6dd0c55 100644 --- a/src/Module/Admin/Item/Source.php +++ b/src/Module/Admin/Item/Source.php @@ -5,12 +5,12 @@ namespace Friendica\Module\Admin\Item; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Model; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; /** * @author Hypolite Petovan */ -class Source extends BaseAdminModule +class Source extends BaseAdmin { public static function content(array $parameters = []) diff --git a/src/Module/Admin/Logs/Settings.php b/src/Module/Admin/Logs/Settings.php index 6b3f2027dc..b8e588cd7d 100644 --- a/src/Module/Admin/Logs/Settings.php +++ b/src/Module/Admin/Logs/Settings.php @@ -4,11 +4,11 @@ namespace Friendica\Module\Admin\Logs; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Util\Strings; use Psr\Log\LogLevel; -class Settings extends BaseAdminModule +class Settings extends BaseAdmin { public static function post(array $parameters = []) { diff --git a/src/Module/Admin/Logs/View.php b/src/Module/Admin/Logs/View.php index a6607829de..dc2274ce7a 100644 --- a/src/Module/Admin/Logs/View.php +++ b/src/Module/Admin/Logs/View.php @@ -4,10 +4,10 @@ namespace Friendica\Module\Admin\Logs; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Util\Strings; -class View extends BaseAdminModule +class View extends BaseAdmin { public static function content(array $parameters = []) { diff --git a/src/Module/Admin/PhpInfo.php b/src/Module/Admin/PhpInfo.php index 3ac7421816..465962eb71 100644 --- a/src/Module/Admin/PhpInfo.php +++ b/src/Module/Admin/PhpInfo.php @@ -2,9 +2,9 @@ namespace Friendica\Module\Admin; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; -class PhpInfo extends BaseAdminModule +class PhpInfo extends BaseAdmin { public static function rawContent(array $parameters = []) { diff --git a/src/Module/Admin/Queue.php b/src/Module/Admin/Queue.php index a9295f6f92..59912fc6c9 100644 --- a/src/Module/Admin/Queue.php +++ b/src/Module/Admin/Queue.php @@ -5,7 +5,7 @@ namespace Friendica\Module\Admin; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Util\Arrays; use Friendica\Util\DateTimeFormat; @@ -17,7 +17,7 @@ use Friendica\Util\DateTimeFormat; * * @return string */ -class Queue extends BaseAdminModule +class Queue extends BaseAdmin { public static function content(array $parameters = []) { diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index 131ebb88ef..7cb3a9b8f7 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -9,7 +9,7 @@ use Friendica\Core\Theme; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Module\Register; use Friendica\Protocol\PortableContact; use Friendica\Util\BasePath; @@ -18,7 +18,7 @@ use Friendica\Worker\Delivery; require_once __DIR__ . '/../../../boot.php'; -class Site extends BaseAdminModule +class Site extends BaseAdmin { public static function post(array $parameters = []) { diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index 234a49b410..4c424a059c 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -11,13 +11,13 @@ use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\DI; use Friendica\Model\Register; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Network\HTTPException\InternalServerErrorException; use Friendica\Util\ConfigFileLoader; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -class Summary extends BaseAdminModule +class Summary extends BaseAdmin { public static function content(array $parameters = []) { diff --git a/src/Module/Admin/Themes/Details.php b/src/Module/Admin/Themes/Details.php index f1263e6ca9..a1617954f1 100644 --- a/src/Module/Admin/Themes/Details.php +++ b/src/Module/Admin/Themes/Details.php @@ -6,10 +6,10 @@ use Friendica\Content\Text\Markdown; use Friendica\Core\Renderer; use Friendica\Core\Theme; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Util\Strings; -class Details extends BaseAdminModule +class Details extends BaseAdmin { public static function post(array $parameters = []) { diff --git a/src/Module/Admin/Themes/Embed.php b/src/Module/Admin/Themes/Embed.php index 00d4de6953..50ecff9322 100644 --- a/src/Module/Admin/Themes/Embed.php +++ b/src/Module/Admin/Themes/Embed.php @@ -4,10 +4,10 @@ namespace Friendica\Module\Admin\Themes; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Util\Strings; -class Embed extends BaseAdminModule +class Embed extends BaseAdmin { public static function init(array $parameters = []) { diff --git a/src/Module/Admin/Themes/Index.php b/src/Module/Admin/Themes/Index.php index c6c86b0a99..4c73a36de8 100644 --- a/src/Module/Admin/Themes/Index.php +++ b/src/Module/Admin/Themes/Index.php @@ -5,10 +5,10 @@ namespace Friendica\Module\Admin\Themes; use Friendica\Core\Renderer; use Friendica\Core\Theme; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Util\Strings; -class Index extends BaseAdminModule +class Index extends BaseAdmin { public static function content(array $parameters = []) { diff --git a/src/Module/Admin/Tos.php b/src/Module/Admin/Tos.php index 4c4f31b655..b89887dae8 100644 --- a/src/Module/Admin/Tos.php +++ b/src/Module/Admin/Tos.php @@ -4,9 +4,9 @@ namespace Friendica\Module\Admin; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; -class Tos extends BaseAdminModule +class Tos extends BaseAdmin { public static function post(array $parameters = []) { diff --git a/src/Module/Admin/Users.php b/src/Module/Admin/Users.php index c4a30abd65..0498a80da1 100644 --- a/src/Module/Admin/Users.php +++ b/src/Module/Admin/Users.php @@ -8,11 +8,11 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Register; use Friendica\Model\User; -use Friendica\Module\BaseAdminModule; +use Friendica\Module\BaseAdmin; use Friendica\Util\Strings; use Friendica\Util\Temporal; -class Users extends BaseAdminModule +class Users extends BaseAdmin { public static function post(array $parameters = []) { diff --git a/src/Module/BaseAdminModule.php b/src/Module/BaseAdmin.php similarity index 98% rename from src/Module/BaseAdminModule.php rename to src/Module/BaseAdmin.php index f0cfb0c11c..b776c8b301 100644 --- a/src/Module/BaseAdminModule.php +++ b/src/Module/BaseAdmin.php @@ -21,7 +21,7 @@ require_once 'boot.php'; * * @package Friendica\Module */ -abstract class BaseAdminModule extends BaseModule +abstract class BaseAdmin extends BaseModule { public static function post(array $parameters = []) { diff --git a/src/Module/BaseSearchModule.php b/src/Module/BaseSearch.php similarity index 99% rename from src/Module/BaseSearchModule.php rename to src/Module/BaseSearch.php index 42bb943da0..26b3ea6060 100644 --- a/src/Module/BaseSearchModule.php +++ b/src/Module/BaseSearch.php @@ -17,7 +17,7 @@ use Friendica\Util\Proxy as ProxyUtils; /** * Base class for search modules */ -class BaseSearchModule extends BaseModule +class BaseSearch extends BaseModule { /** * Performs a contact search with an optional prefix diff --git a/src/Module/BaseSettingsModule.php b/src/Module/BaseSettings.php similarity index 98% rename from src/Module/BaseSettingsModule.php rename to src/Module/BaseSettings.php index 225f5ed4ae..d4652cc9f1 100644 --- a/src/Module/BaseSettingsModule.php +++ b/src/Module/BaseSettings.php @@ -7,7 +7,7 @@ use Friendica\Content\Feature; use Friendica\Core\Renderer; use Friendica\DI; -class BaseSettingsModule extends BaseModule +class BaseSettings extends BaseModule { public static function content(array $parameters = []) { diff --git a/src/Module/Search/Directory.php b/src/Module/Search/Directory.php index 84dd4c2dda..0540914f59 100644 --- a/src/Module/Search/Directory.php +++ b/src/Module/Search/Directory.php @@ -4,14 +4,14 @@ namespace Friendica\Module\Search; use Friendica\Content\Widget; use Friendica\DI; -use Friendica\Module\BaseSearchModule; +use Friendica\Module\BaseSearch; use Friendica\Module\Security\Login; use Friendica\Util\Strings; /** * Directory search module */ -class Directory extends BaseSearchModule +class Directory extends BaseSearch { public static function content(array $parameters = []) { diff --git a/src/Module/Search/Index.php b/src/Module/Search/Index.php index 69646fd1bd..1f8bfe4bc2 100644 --- a/src/Module/Search/Index.php +++ b/src/Module/Search/Index.php @@ -15,11 +15,11 @@ use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Model\Term; -use Friendica\Module\BaseSearchModule; +use Friendica\Module\BaseSearch; use Friendica\Network\HTTPException; use Friendica\Util\Strings; -class Index extends BaseSearchModule +class Index extends BaseSearch { public static function content(array $parameters = []) { diff --git a/src/Module/Settings/Delegation.php b/src/Module/Settings/Delegation.php index d7f49e6a90..c6d587d908 100644 --- a/src/Module/Settings/Delegation.php +++ b/src/Module/Settings/Delegation.php @@ -8,14 +8,14 @@ use Friendica\Core\Session; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\User; -use Friendica\Module\BaseSettingsModule; +use Friendica\Module\BaseSettings; use Friendica\Network\HTTPException; use Friendica\Util\Strings; /** * Account delegation settings module */ -class Delegation extends BaseSettingsModule +class Delegation extends BaseSettings { public static function post(array $parameters = []) { diff --git a/src/Module/Settings/Profile/Index.php b/src/Module/Settings/Profile/Index.php index b0eb194edd..ea9b41866a 100644 --- a/src/Module/Settings/Profile/Index.php +++ b/src/Module/Settings/Profile/Index.php @@ -16,14 +16,14 @@ use Friendica\Model\GContact; use Friendica\Model\Profile; use Friendica\Model\ProfileField; use Friendica\Model\User; -use Friendica\Module\BaseSettingsModule; +use Friendica\Module\BaseSettings; use Friendica\Module\Security\Login; use Friendica\Network\HTTPException; use Friendica\Util\DateTimeFormat; use Friendica\Util\Strings; use Friendica\Util\Temporal; -class Index extends BaseSettingsModule +class Index extends BaseSettings { public static function post(array $parameters = []) { diff --git a/src/Module/Settings/Profile/Photo/Crop.php b/src/Module/Settings/Profile/Photo/Crop.php index 738e3fcb2a..1ae828d2a2 100644 --- a/src/Module/Settings/Profile/Photo/Crop.php +++ b/src/Module/Settings/Profile/Photo/Crop.php @@ -9,10 +9,10 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Photo; -use Friendica\Module\BaseSettingsModule; +use Friendica\Module\BaseSettings; use Friendica\Network\HTTPException; -class Crop extends BaseSettingsModule +class Crop extends BaseSettings { public static function post(array $parameters = []) { diff --git a/src/Module/Settings/Profile/Photo/Index.php b/src/Module/Settings/Profile/Photo/Index.php index 9d2648abd8..97171f7aa9 100644 --- a/src/Module/Settings/Profile/Photo/Index.php +++ b/src/Module/Settings/Profile/Photo/Index.php @@ -8,13 +8,13 @@ use Friendica\Core\Session; use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Photo; -use Friendica\Module\BaseSettingsModule; +use Friendica\Module\BaseSettings; use Friendica\Network\HTTPException; use Friendica\Object\Image; use Friendica\Util\Images; use Friendica\Util\Strings; -class Index extends BaseSettingsModule +class Index extends BaseSettings { public static function post(array $parameters = []) { diff --git a/src/Module/Settings/TwoFactor/AppSpecific.php b/src/Module/Settings/TwoFactor/AppSpecific.php index 6a8821e5f7..c2e24e8b48 100644 --- a/src/Module/Settings/TwoFactor/AppSpecific.php +++ b/src/Module/Settings/TwoFactor/AppSpecific.php @@ -5,7 +5,7 @@ namespace Friendica\Module\Settings\TwoFactor; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Model\TwoFactor\AppSpecificPassword; -use Friendica\Module\BaseSettingsModule; +use Friendica\Module\BaseSettings; use Friendica\Module\Security\Login; /** @@ -13,7 +13,7 @@ use Friendica\Module\Security\Login; * * @package Friendica\Module\TwoFactor */ -class AppSpecific extends BaseSettingsModule +class AppSpecific extends BaseSettings { private static $appSpecificPassword = null; diff --git a/src/Module/Settings/TwoFactor/Index.php b/src/Module/Settings/TwoFactor/Index.php index ab3400801e..0c021d4211 100644 --- a/src/Module/Settings/TwoFactor/Index.php +++ b/src/Module/Settings/TwoFactor/Index.php @@ -8,11 +8,11 @@ use Friendica\DI; use Friendica\Model\TwoFactor\AppSpecificPassword; use Friendica\Model\TwoFactor\RecoveryCode; use Friendica\Model\User; -use Friendica\Module\BaseSettingsModule; +use Friendica\Module\BaseSettings; use Friendica\Module\Security\Login; use PragmaRX\Google2FA\Google2FA; -class Index extends BaseSettingsModule +class Index extends BaseSettings { public static function post(array $parameters = []) { diff --git a/src/Module/Settings/TwoFactor/Recovery.php b/src/Module/Settings/TwoFactor/Recovery.php index 18c372c53c..089283d332 100644 --- a/src/Module/Settings/TwoFactor/Recovery.php +++ b/src/Module/Settings/TwoFactor/Recovery.php @@ -5,7 +5,7 @@ namespace Friendica\Module\Settings\TwoFactor; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Model\TwoFactor\RecoveryCode; -use Friendica\Module\BaseSettingsModule; +use Friendica\Module\BaseSettings; use Friendica\Module\Security\Login; /** @@ -13,7 +13,7 @@ use Friendica\Module\Security\Login; * * @package Friendica\Module\TwoFactor */ -class Recovery extends BaseSettingsModule +class Recovery extends BaseSettings { public static function init(array $parameters = []) { diff --git a/src/Module/Settings/TwoFactor/Verify.php b/src/Module/Settings/TwoFactor/Verify.php index 2eae0300ae..d832dd622b 100644 --- a/src/Module/Settings/TwoFactor/Verify.php +++ b/src/Module/Settings/TwoFactor/Verify.php @@ -9,7 +9,7 @@ use BaconQrCode\Writer; use Friendica\Core\Renderer; use Friendica\Core\Session; use Friendica\DI; -use Friendica\Module\BaseSettingsModule; +use Friendica\Module\BaseSettings; use Friendica\Module\Security\Login; use PragmaRX\Google2FA\Google2FA; @@ -18,7 +18,7 @@ use PragmaRX\Google2FA\Google2FA; * * @package Friendica\Module\TwoFactor\Settings */ -class Verify extends BaseSettingsModule +class Verify extends BaseSettings { public static function init(array $parameters = []) { diff --git a/src/Module/Settings/UserExport.php b/src/Module/Settings/UserExport.php index 8d04e85360..a1ea50353d 100644 --- a/src/Module/Settings/UserExport.php +++ b/src/Module/Settings/UserExport.php @@ -11,12 +11,12 @@ use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\DI; -use Friendica\Module\BaseSettingsModule; +use Friendica\Module\BaseSettings; /** * Module to export user data **/ -class UserExport extends BaseSettingsModule +class UserExport extends BaseSettings { /** * Handle the request to export data. From 07a4bb73fa7d65d00f888eed7dedd1d4e1f623ad Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 23 Jan 2020 09:04:00 -0500 Subject: [PATCH 2/5] Add DDD classes for Mastodon\Field entity --- src/Collection/Api/Mastodon/Fields.php | 20 +++++++++++++ src/DI.php | 8 ++++++ src/Factory/Api/Mastodon/Field.php | 39 ++++++++++++++++++++++++++ src/Object/Api/Mastodon/Field.php | 10 ++++++- 4 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/Collection/Api/Mastodon/Fields.php create mode 100644 src/Factory/Api/Mastodon/Field.php diff --git a/src/Collection/Api/Mastodon/Fields.php b/src/Collection/Api/Mastodon/Fields.php new file mode 100644 index 0000000000..2bc549dd7f --- /dev/null +++ b/src/Collection/Api/Mastodon/Fields.php @@ -0,0 +1,20 @@ +totalCount = $totalCount ?? count($entities); + } +} diff --git a/src/DI.php b/src/DI.php index 65c82225d5..83351d3477 100644 --- a/src/DI.php +++ b/src/DI.php @@ -236,6 +236,14 @@ abstract class DI return self::$dice->create(Factory\Api\Mastodon\Emoji::class); } + /** + * @return Factory\Api\Mastodon\Field + */ + public static function mstdnField() + { + return self::$dice->create(Factory\Api\Mastodon\Field::class); + } + /** * @return Factory\Api\Mastodon\FollowRequest */ diff --git a/src/Factory/Api/Mastodon/Field.php b/src/Factory/Api/Mastodon/Field.php new file mode 100644 index 0000000000..10bb2690fe --- /dev/null +++ b/src/Factory/Api/Mastodon/Field.php @@ -0,0 +1,39 @@ +label, BBCode::convert($profileField->value, false, 9)); + } + + /** + * @param ProfileFields $profileFields + * @return Fields + * @throws HTTPException\InternalServerErrorException + */ + public function createFromProfileFields(ProfileFields $profileFields) + { + $fields = []; + + foreach ($profileFields as $profileField) { + $fields[] = $this->createFromProfileField($profileField); + } + + return new Fields($fields); + } +} diff --git a/src/Object/Api/Mastodon/Field.php b/src/Object/Api/Mastodon/Field.php index 07cd2e501b..a32eae04a2 100644 --- a/src/Object/Api/Mastodon/Field.php +++ b/src/Object/Api/Mastodon/Field.php @@ -7,7 +7,7 @@ use Friendica\BaseEntity; /** * Class Field * - * @see https://docs.joinmastodon.org/api/entities/#field + * @see https://docs.joinmastodon.org/entities/field/ */ class Field extends BaseEntity { @@ -17,4 +17,12 @@ class Field extends BaseEntity protected $value; /** @var string (Datetime)*/ protected $verified_at; + + public function __construct(string $name, string $value) + { + $this->name = $name; + $this->value = $value; + // Link verification unsupported + $this->verified_at = null; + } } From 608e634858944601a6041ac7e88a4e7abb0f49e0 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 23 Jan 2020 09:06:50 -0500 Subject: [PATCH 3/5] Update Mastodon API with new profile field entity --- src/Factory/Api/Mastodon/Account.php | 33 ++++++++++++++++++++--- src/Object/Api/Mastodon/Account.php | 5 ++-- src/Object/Api/Mastodon/FollowRequest.php | 3 ++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/Factory/Api/Mastodon/Account.php b/src/Factory/Api/Mastodon/Account.php index 60f9a76e11..a58f8941ef 100644 --- a/src/Factory/Api/Mastodon/Account.php +++ b/src/Factory/Api/Mastodon/Account.php @@ -4,26 +4,35 @@ namespace Friendica\Factory\Api\Mastodon; use Friendica\App\BaseURL; use Friendica\BaseFactory; +use Friendica\Collection\Api\Mastodon\Fields; use Friendica\Model\APContact; use Friendica\Model\Contact; use Friendica\Network\HTTPException; +use Friendica\Repository\PermissionSet; +use Friendica\Repository\ProfileField; use Psr\Log\LoggerInterface; class Account extends BaseFactory { /** @var BaseURL */ protected $baseUrl; + /** @var ProfileField */ + protected $profileField; + /** @var Field */ + protected $mstdnField; - public function __construct(LoggerInterface $logger, BaseURL $baseURL) + public function __construct(LoggerInterface $logger, BaseURL $baseURL, ProfileField $profileField, Field $mstdnField) { parent::__construct($logger); $this->baseUrl = $baseURL; + $this->profileField = $profileField; + $this->mstdnField = $mstdnField; } /** * @param int $contactId - * @param int $uid User Id + * @param int $uid Public contact (=0) or owner user id * @return \Friendica\Object\Api\Mastodon\Account * @throws HTTPException\InternalServerErrorException * @throws \ImagickException @@ -41,6 +50,24 @@ class Account extends BaseFactory $apcontact = APContact::getByURL($publicContact['url'], false); - return new \Friendica\Object\Api\Mastodon\Account($this->baseUrl, $publicContact, $apcontact, $userContact); + return new \Friendica\Object\Api\Mastodon\Account($this->baseUrl, $publicContact, new Fields(), $apcontact, $userContact); + } + + /** + * @param int $userId + * @return \Friendica\Object\Api\Mastodon\Account + * @throws HTTPException\InternalServerErrorException + * @throws \ImagickException + */ + public function createFromUserId(int $userId) + { + $publicContact = Contact::selectFirst([], ['uid' => $userId, 'self' => true]); + + $profileFields = $this->profileField->select(['uid' => $userId, 'psid' => PermissionSet::PUBLIC]); + $fields = $this->mstdnField->createFromProfileFields($profileFields); + + $apcontact = APContact::getByURL($publicContact['url'], false); + + return new \Friendica\Object\Api\Mastodon\Account($this->baseUrl, $publicContact, $fields, $apcontact); } } diff --git a/src/Object/Api/Mastodon/Account.php b/src/Object/Api/Mastodon/Account.php index 38eefee3df..a5f401a0f3 100644 --- a/src/Object/Api/Mastodon/Account.php +++ b/src/Object/Api/Mastodon/Account.php @@ -4,6 +4,7 @@ namespace Friendica\Object\Api\Mastodon; use Friendica\App\BaseURL; use Friendica\BaseEntity; +use Friendica\Collection\Api\Mastodon\Fields; use Friendica\Content\Text\BBCode; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -70,7 +71,7 @@ class Account extends BaseEntity * @param array $userContact Optional full contact table record with uid != 0 * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function __construct(BaseURL $baseUrl, array $publicContact, array $apcontact = [], array $userContact = []) + public function __construct(BaseURL $baseUrl, array $publicContact, Fields $fields, array $apcontact = [], array $userContact = []) { $this->id = $publicContact['id']; $this->username = $publicContact['nick']; @@ -94,7 +95,7 @@ class Account extends BaseEntity // No custom emojis per account in Friendica $this->emojis = []; // No metadata fields in Friendica - $this->fields = []; + $this->fields = $fields->getArrayCopy(); $this->bot = ($publicContact['contact-type'] == Contact::TYPE_NEWS); $this->group = ($publicContact['contact-type'] == Contact::TYPE_COMMUNITY); $this->discoverable = !$publicContact['unsearchable']; diff --git a/src/Object/Api/Mastodon/FollowRequest.php b/src/Object/Api/Mastodon/FollowRequest.php index ed72f07d54..2e1257d3e4 100644 --- a/src/Object/Api/Mastodon/FollowRequest.php +++ b/src/Object/Api/Mastodon/FollowRequest.php @@ -3,6 +3,7 @@ namespace Friendica\Object\Api\Mastodon; use Friendica\App\BaseURL; +use Friendica\Collection\Api\Mastodon\Fields; /** * Virtual entity to separate Accounts from Follow Requests. @@ -24,7 +25,7 @@ class FollowRequest extends Account */ public function __construct(BaseURL $baseUrl, int $introduction_id, array $publicContact, array $apcontact = [], array $userContact = []) { - parent::__construct($baseUrl, $publicContact, $apcontact, $userContact); + parent::__construct($baseUrl, $publicContact, new Fields(), $apcontact, $userContact); $this->id = $introduction_id; } From dd24b3bac0fdc87c83d747de6dd168e571984d81 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 23 Jan 2020 09:08:37 -0500 Subject: [PATCH 4/5] Move api/profile/show to src/Module - Update API documentation - Update BaseApi::format to include headers by format --- doc/API-Friendica.md | 23 +++- include/api.php | 126 ---------------------- src/Module/Api/Friendica/Profile/Show.php | 114 ++++++++++++++++++++ src/Module/BaseApi.php | 47 ++++++-- static/routes.config.php | 3 + tests/include/ApiTest.php | 96 ----------------- 6 files changed, 175 insertions(+), 234 deletions(-) create mode 100644 src/Module/Api/Friendica/Profile/Show.php diff --git a/doc/API-Friendica.md b/doc/API-Friendica.md index 84467430ae..013dd08f59 100644 --- a/doc/API-Friendica.md +++ b/doc/API-Friendica.md @@ -645,11 +645,7 @@ On error: ### GET api/friendica/profile/show -Returns the [Profile](help/API-Entities#Profile) data of all profiles or a single profile of the authenticated user. - -#### Parameters - -* `profile_id` (optional): id of the profile to be returned. If omitted all profiles are returned by default. +Returns the [Profile](help/API-Entities#Profile) data of the authenticated user. #### Return values @@ -664,6 +660,23 @@ HTTP 403 Forbidden: when no authentication was provided HTTP 400 Bad Request: if given profile_id is not in the database or is not assigned to the authenticated user General description of profile data in API returns: +- hide_friends: true if friends are hidden +- profile_photo +- profile_thumb +- publish: true if published on the server's local directory +- net_publish: true if published to global_dir +- fullname +- date_of_birth +- description +- xmpp +- homepage +- address +- locality +- region +- postal_code +- country +- pub_keywords +- custom_fields: list of public custom fields --- diff --git a/include/api.php b/include/api.php index 3f4d5625b0..b602dcd687 100644 --- a/include/api.php +++ b/include/api.php @@ -2906,60 +2906,6 @@ function api_format_items_activities($item, $type = "json") return $activities; } - -/** - * return data from profiles - * - * @param array $profile_row array containing data from db table 'profile' - * @return array - * @throws InternalServerErrorException - */ -function api_format_items_profiles($profile_row) -{ - $profile = [ - 'profile_id' => $profile_row['id'], - 'profile_name' => $profile_row['profile-name'], - 'is_default' => $profile_row['is-default'] ? true : false, - 'hide_friends' => $profile_row['hide-friends'] ? true : false, - 'profile_photo' => $profile_row['photo'], - 'profile_thumb' => $profile_row['thumb'], - 'publish' => $profile_row['publish'] ? true : false, - 'net_publish' => $profile_row['net-publish'] ? true : false, - 'description' => $profile_row['pdesc'], - 'date_of_birth' => $profile_row['dob'], - 'address' => $profile_row['address'], - 'city' => $profile_row['locality'], - 'region' => $profile_row['region'], - 'postal_code' => $profile_row['postal-code'], - 'country' => $profile_row['country-name'], - 'hometown' => $profile_row['hometown'], - 'gender' => $profile_row['gender'], - 'marital' => $profile_row['marital'], - 'marital_with' => $profile_row['with'], - 'marital_since' => $profile_row['howlong'], - 'sexual' => $profile_row['sexual'], - 'politic' => $profile_row['politic'], - 'religion' => $profile_row['religion'], - 'public_keywords' => $profile_row['pub_keywords'], - 'private_keywords' => $profile_row['prv_keywords'], - 'likes' => BBCode::convert(api_clean_plain_items($profile_row['likes']) , false, 2), - 'dislikes' => BBCode::convert(api_clean_plain_items($profile_row['dislikes']) , false, 2), - 'about' => BBCode::convert(api_clean_plain_items($profile_row['about']) , false, 2), - 'music' => BBCode::convert(api_clean_plain_items($profile_row['music']) , false, 2), - 'book' => BBCode::convert(api_clean_plain_items($profile_row['book']) , false, 2), - 'tv' => BBCode::convert(api_clean_plain_items($profile_row['tv']) , false, 2), - 'film' => BBCode::convert(api_clean_plain_items($profile_row['film']) , false, 2), - 'interest' => BBCode::convert(api_clean_plain_items($profile_row['interest']) , false, 2), - 'romance' => BBCode::convert(api_clean_plain_items($profile_row['romance']) , false, 2), - 'work' => BBCode::convert(api_clean_plain_items($profile_row['work']) , false, 2), - 'education' => BBCode::convert(api_clean_plain_items($profile_row['education']), false, 2), - 'social_networks' => BBCode::convert(api_clean_plain_items($profile_row['contact']) , false, 2), - 'homepage' => $profile_row['homepage'], - 'users' => null - ]; - return $profile; -} - /** * format items to be returned by api * @@ -6102,78 +6048,6 @@ function api_friendica_direct_messages_search($type, $box = "") /// @TODO move to top of file or somewhere better api_register_func('api/friendica/direct_messages_search', 'api_friendica_direct_messages_search', true); -/** - * return data of all the profiles a user has to the client - * - * @param string $type Known types are 'atom', 'rss', 'xml' and 'json' - * @return string|array - * @throws BadRequestException - * @throws ForbiddenException - * @throws ImagickException - * @throws InternalServerErrorException - * @throws UnauthorizedException - */ -function api_friendica_profile_show($type) -{ - $a = DI::app(); - - if (api_user() === false) { - throw new ForbiddenException(); - } - - // input params - $profile_id = $_REQUEST['profile_id'] ?? 0; - - // retrieve general information about profiles for user - $multi_profiles = Feature::isEnabled(api_user(), 'multi_profiles'); - $directory = DI::config()->get('system', 'directory'); - - // get data of the specified profile id or all profiles of the user if not specified - if ($profile_id != 0) { - $r = Profile::getById(api_user(), $profile_id); - // error message if specified gid is not in database - if (!DBA::isResult($r)) { - throw new BadRequestException("profile_id not available"); - } - } else { - $r = Profile::getListByUser(api_user()); - } - // loop through all returned profiles and retrieve data and users - $k = 0; - $profiles = []; - if (DBA::isResult($r)) { - foreach ($r as $rr) { - $profile = api_format_items_profiles($rr); - - // select all users from contact table, loop and prepare standard return for user data - $users = []; - $nurls = Contact::selectToArray(['id', 'nurl'], ['uid' => api_user(), 'profile-id' => $rr['id']]); - foreach ($nurls as $nurl) { - $user = api_get_user($a, $nurl['nurl']); - ($type == "xml") ? $users[$k++ . ":user"] = $user : $users[] = $user; - } - $profile['users'] = $users; - - // add prepared profile data to array for final return - if ($type == "xml") { - $profiles[$k++ . ":profile"] = $profile; - } else { - $profiles[] = $profile; - } - } - } - - // return settings, authenticated user and profiles data - $self = DBA::selectFirst('contact', ['nurl'], ['uid' => api_user(), 'self' => true]); - - $result = ['multi_profiles' => $multi_profiles ? true : false, - 'global_dir' => $directory, - 'friendica_owner' => api_get_user($a, $self['nurl']), - 'profiles' => $profiles]; - return api_format_data("friendica_profiles", $type, ['$result' => $result]); -} -api_register_func('api/friendica/profile/show', 'api_friendica_profile_show', true, API_METHOD_GET); - /** * Returns a list of saved searches. * diff --git a/src/Module/Api/Friendica/Profile/Show.php b/src/Module/Api/Friendica/Profile/Show.php new file mode 100644 index 0000000000..2c50c53d50 --- /dev/null +++ b/src/Module/Api/Friendica/Profile/Show.php @@ -0,0 +1,114 @@ +get('system', 'directory'); + + $profile = Profile::getByUID(self::$current_user_id); + + $profileFields = DI::profileField()->select(['uid' => self::$current_user_id, 'psid' => PermissionSet::PUBLIC]); + + $profile = self::formatProfile($profile, $profileFields); + + $profiles = []; + if (self::$format == 'xml') { + $profiles['0:profile'] = $profile; + } else { + $profiles[] = $profile; + } + + // return settings, authenticated user and profiles data + $self = Contact::selectFirst(['nurl'], ['uid' => self::$current_user_id, 'self' => true]); + + $result = [ + 'multi_profiles' => false, + 'global_dir' => $directory, + 'friendica_owner' => self::getUser($self['nurl']), + 'profiles' => $profiles + ]; + + echo self::format('friendica_profiles', ['$result' => $result]); + exit; + } + + /** + * @param array $profile_row array containing data from db table 'profile' + * @param ProfileFields $profileFields + * @return array + * @throws HTTPException\InternalServerErrorException + */ + private static function formatProfile($profile_row, ProfileFields $profileFields) + { + $custom_fields = []; + foreach ($profileFields as $profileField) { + $custom_fields[] = [ + 'label' => $profileField->label, + 'value' => BBCode::convert($profileField->value, false, 2), + ]; + } + + return [ + 'profile_id' => $profile_row['id'], + 'profile_name' => null, + 'is_default' => null, + 'hide_friends' => $profile_row['hide-friends'] ? true : false, + 'profile_photo' => $profile_row['photo'], + 'profile_thumb' => $profile_row['thumb'], + 'publish' => $profile_row['publish'] ? true : false, + 'net_publish' => $profile_row['net-publish'] ? true : false, + 'description' => $profile_row['pdesc'], + 'date_of_birth' => $profile_row['dob'], + 'address' => $profile_row['address'], + 'city' => $profile_row['locality'], + 'region' => $profile_row['region'], + 'postal_code' => $profile_row['postal-code'], + 'country' => $profile_row['country-name'], + 'hometown' => null, + 'gender' => null, + 'marital' => null, + 'marital_with' => null, + 'marital_since' => null, + 'sexual' => null, + 'politic' => null, + 'religion' => null, + 'public_keywords' => $profile_row['pub_keywords'], + 'private_keywords' => $profile_row['prv_keywords'], + 'likes' => null, + 'dislikes' => null, + 'about' => null, + 'music' => null, + 'book' => null, + 'tv' => null, + 'film' => null, + 'interest' => null, + 'romance' => null, + 'work' => null, + 'education' => null, + 'social_networks' => null, + 'homepage' => $profile_row['homepage'], + 'users' => [], + 'custom_fields' => $custom_fields, + ]; + } +} diff --git a/src/Module/BaseApi.php b/src/Module/BaseApi.php index 81814bb0d4..543293872d 100644 --- a/src/Module/BaseApi.php +++ b/src/Module/BaseApi.php @@ -87,20 +87,53 @@ class BaseApi extends BaseModule return api_get_user(DI::app(), $contact_id); } - protected static function format($root_element, $data) + /** + * Formats the data according to the data type + * + * @param string $root_element + * @param array $data An array with a single element containing the returned result + * @return false|string + */ + protected static function format(string $root_element, array $data) { + $return = api_format_data($root_element, self::$format, $data); + switch (self::$format) { - case "atom": - case "rss": case "xml": - $ret = api_create_xml($data, $root_element); + header("Content-Type: text/xml"); break; case "json": - default: - $ret = $data; + header("Content-Type: application/json"); + if (!empty($return)) { + $json = json_encode(end($return)); + if (!empty($_GET['callback'])) { + $json = $_GET['callback'] . "(" . $json . ")"; + } + $return = $json; + } + break; + case "rss": + header("Content-Type: application/rss+xml"); + $return = '' . "\n" . $return; + break; + case "atom": + header("Content-Type: application/atom+xml"); + $return = '' . "\n" . $return; break; } + + return $return; + } - return $ret; + /** + * Creates the XML from a JSON style array + * + * @param $data + * @param $root_element + * @return string + */ + protected static function createXml($data, $root_element) + { + return api_create_xml($data, $root_element); } } diff --git a/static/routes.config.php b/static/routes.config.php index 4aad69d8c7..aac2cbb1b5 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -35,6 +35,9 @@ return [ '/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]], '/instance/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]], ], + '/friendica' => [ + '/profile/show' => [Module\Api\Friendica\Profile\Show::class , [R::GET ]], + ], ], '/admin' => [ diff --git a/tests/include/ApiTest.php b/tests/include/ApiTest.php index 3ef64b3171..6920ea2bf2 100644 --- a/tests/include/ApiTest.php +++ b/tests/include/ApiTest.php @@ -2488,102 +2488,6 @@ class ApiTest extends DatabaseTest $this->assertArrayHasKey('friendica:attendmaybe', $result); } - /** - * Test the api_format_items_profiles() function. - * - * @return void - */ - public function testApiFormatItemsProfiles() - { - $profile_row = [ - 'id' => 'profile_id', - 'profile-name' => 'profile_name', - 'is-default' => true, - 'hide-friends' => true, - 'photo' => 'profile_photo', - 'thumb' => 'profile_thumb', - 'publish' => true, - 'net-publish' => true, - 'pdesc' => 'description', - 'dob' => 'date_of_birth', - 'address' => 'address', - 'locality' => 'city', - 'region' => 'region', - 'postal-code' => 'postal_code', - 'country-name' => 'country', - 'hometown' => 'hometown', - 'gender' => 'gender', - 'marital' => 'marital', - 'with' => 'marital_with', - 'howlong' => 'marital_since', - 'sexual' => 'sexual', - 'politic' => 'politic', - 'religion' => 'religion', - 'pub_keywords' => 'public_keywords', - 'prv_keywords' => 'private_keywords', - - 'likes' => 'likes', - 'dislikes' => 'dislikes', - 'about' => 'about', - 'music' => 'music', - 'book' => 'book', - 'tv' => 'tv', - 'film' => 'film', - 'interest' => 'interest', - 'romance' => 'romance', - 'work' => 'work', - 'education' => 'education', - 'contact' => 'social_networks', - 'homepage' => 'homepage' - ]; - $result = api_format_items_profiles($profile_row); - $this->assertEquals( - [ - 'profile_id' => 'profile_id', - 'profile_name' => 'profile_name', - 'is_default' => true, - 'hide_friends' => true, - 'profile_photo' => 'profile_photo', - 'profile_thumb' => 'profile_thumb', - 'publish' => true, - 'net_publish' => true, - 'description' => 'description', - 'date_of_birth' => 'date_of_birth', - 'address' => 'address', - 'city' => 'city', - 'region' => 'region', - 'postal_code' => 'postal_code', - 'country' => 'country', - 'hometown' => 'hometown', - 'gender' => 'gender', - 'marital' => 'marital', - 'marital_with' => 'marital_with', - 'marital_since' => 'marital_since', - 'sexual' => 'sexual', - 'politic' => 'politic', - 'religion' => 'religion', - 'public_keywords' => 'public_keywords', - 'private_keywords' => 'private_keywords', - - 'likes' => 'likes', - 'dislikes' => 'dislikes', - 'about' => 'about', - 'music' => 'music', - 'book' => 'book', - 'tv' => 'tv', - 'film' => 'film', - 'interest' => 'interest', - 'romance' => 'romance', - 'work' => 'work', - 'education' => 'education', - 'social_networks' => 'social_networks', - 'homepage' => 'homepage', - 'users' => null - ], - $result - ); - } - /** * Test the api_format_items() function. * From 940e4c83cbc55169ab501aada450c22a299b373a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 29 Jan 2020 23:14:34 -0500 Subject: [PATCH 5/5] Remove obsolete tests --- tests/include/ApiTest.php | 52 --------------------------------------- 1 file changed, 52 deletions(-) diff --git a/tests/include/ApiTest.php b/tests/include/ApiTest.php index 6920ea2bf2..014606187b 100644 --- a/tests/include/ApiTest.php +++ b/tests/include/ApiTest.php @@ -3896,58 +3896,6 @@ XML; $this->markTestIncomplete(); } - /** - * Test the api_friendica_profile_show() function. - * - * @return void - */ - public function testApiFriendicaProfileShow() - { - $result = api_friendica_profile_show('json'); - // We can't use assertSelfUser() here because the user object is missing some properties. - $this->assertEquals($this->selfUser['id'], $result['$result']['friendica_owner']['cid']); - $this->assertEquals('DFRN', $result['$result']['friendica_owner']['location']); - $this->assertEquals($this->selfUser['name'], $result['$result']['friendica_owner']['name']); - $this->assertEquals($this->selfUser['nick'], $result['$result']['friendica_owner']['screen_name']); - $this->assertEquals('dfrn', $result['$result']['friendica_owner']['network']); - $this->assertTrue($result['$result']['friendica_owner']['verified']); - $this->assertFalse($result['$result']['multi_profiles']); - } - - /** - * Test the api_friendica_profile_show() function with a profile ID. - * - * @return void - */ - public function testApiFriendicaProfileShowWithProfileId() - { - $this->markTestIncomplete('We need to add a dataset for this.'); - } - - /** - * Test the api_friendica_profile_show() function with a wrong profile ID. - * - * @return void - * @expectedException Friendica\Network\HTTPException\BadRequestException - */ - public function testApiFriendicaProfileShowWithWrongProfileId() - { - $_REQUEST['profile_id'] = 666; - api_friendica_profile_show('json'); - } - - /** - * Test the api_friendica_profile_show() function without an authenticated user. - * - * @return void - * @expectedException Friendica\Network\HTTPException\ForbiddenException - */ - public function testApiFriendicaProfileShowWithoutAuthenticatedUser() - { - $_SESSION['authenticated'] = false; - api_friendica_profile_show('json'); - } - /** * Test the api_saved_searches_list() function. *