diff options
7 files changed, 25 insertions, 33 deletions
diff --git a/lib/private/Contacts/ContactsMenu/ActionFactory.php b/lib/private/Contacts/ContactsMenu/ActionFactory.php index 5218582802c..891951a88e5 100644 --- a/lib/private/Contacts/ContactsMenu/ActionFactory.php +++ b/lib/private/Contacts/ContactsMenu/ActionFactory.php @@ -29,29 +29,21 @@ use OCP\Contacts\ContactsMenu\ILinkAction; class ActionFactory implements IActionFactory { /** - * @param string $icon - * @param string $name - * @param string $href - * @param string $appName - * @return ILinkAction + * {@inheritDoc} */ - public function newLinkAction(string $icon, string $name, string $href, string $appName = ''): ILinkAction { + public function newLinkAction(string $icon, string $name, string $href, string $appId = ''): ILinkAction { $action = new LinkAction(); $action->setName($name); $action->setIcon($icon); $action->setHref($href); - $action->setAppName($appName); + $action->setAppId($appId); return $action; } /** - * @param string $icon - * @param string $name - * @param string $email - * @param string $appName - * @return ILinkAction + * {@inheritDoc} */ - public function newEMailAction(string $icon, string $name, string $email, string $appName = ''): ILinkAction { - return $this->newLinkAction($icon, $name, 'mailto:' . $email, $appName); + public function newEMailAction(string $icon, string $name, string $email, string $appId = ''): ILinkAction { + return $this->newLinkAction($icon, $name, 'mailto:' . $email, $appId); } } diff --git a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php index a38bad9d82f..5acafed2fda 100644 --- a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php +++ b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php @@ -39,7 +39,7 @@ class LinkAction implements ILinkAction { private $priority = 10; /** @var string */ - private $appName; + private $appId; /** * @param string $icon absolute URI to an icon @@ -91,19 +91,19 @@ class LinkAction implements ILinkAction { } /** - * @param string $appName + * @param string $appId * @since 23.0.0 */ - public function setAppName(string $appName) { - $this->appName = $appName; + public function setAppId(string $appId) { + $this->appId = $appId; } /** * @return string * @since 23.0.0 */ - public function getAppName(): string { - return $this->appName; + public function getAppId(): string { + return $this->appId; } /** @@ -114,7 +114,7 @@ class LinkAction implements ILinkAction { 'title' => $this->name, 'icon' => $this->icon, 'hyperlink' => $this->href, - 'appName' => $this->appName, + 'appId' => $this->appId, ]; } } diff --git a/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php b/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php index 9ae323c18c3..d69f219e84c 100644 --- a/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php +++ b/lib/private/Contacts/ContactsMenu/Providers/EMailProvider.php @@ -54,7 +54,7 @@ class EMailProvider implements IProvider { // Skip continue; } - $action = $this->actionFactory->newEMailAction($iconUrl, $address, $address); + $action = $this->actionFactory->newEMailAction($iconUrl, $address, $address, 'email'); $entry->addAction($action); } } diff --git a/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php b/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php index 4882c0ac883..88370f193a1 100644 --- a/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php +++ b/lib/private/Contacts/ContactsMenu/Providers/ProfileProvider.php @@ -83,7 +83,7 @@ class ProfileProvider implements IProvider { $iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/profile.svg')); $profileActionText = $this->l10nFactory->get('core')->t('View profile'); $profileUrl = $this->urlGenerator->linkToRouteAbsolute('core.ProfilePage.index', ['targetUserId' => $targetUserId]); - $action = $this->actionFactory->newLinkAction($iconUrl, $profileActionText, $profileUrl); + $action = $this->actionFactory->newLinkAction($iconUrl, $profileActionText, $profileUrl, 'profile'); // Set highest priority (by descending order), other actions have the default priority 10 as defined in lib/private/Contacts/ContactsMenu/Actions/LinkAction.php $action->setPriority(20); $entry->addAction($action); diff --git a/lib/public/Contacts/ContactsMenu/IAction.php b/lib/public/Contacts/ContactsMenu/IAction.php index 7c9db063975..9b08bbbf04b 100644 --- a/lib/public/Contacts/ContactsMenu/IAction.php +++ b/lib/public/Contacts/ContactsMenu/IAction.php @@ -62,14 +62,14 @@ interface IAction extends JsonSerializable { public function getPriority(); /** - * @param string $appName + * @param string $appId * @since 23.0.0 */ - public function setAppName(string $appName); + public function setAppId(string $appId); /** * @return string * @since 23.0.0 */ - public function getAppName(): string; + public function getAppId(): string; } diff --git a/lib/public/Contacts/ContactsMenu/IActionFactory.php b/lib/public/Contacts/ContactsMenu/IActionFactory.php index 393c9eb487a..b4e4eb96819 100644 --- a/lib/public/Contacts/ContactsMenu/IActionFactory.php +++ b/lib/public/Contacts/ContactsMenu/IActionFactory.php @@ -35,10 +35,10 @@ interface IActionFactory { * @param string $icon full path to the action's icon * @param string $name localized name of the action * @param string $href target URL - * @param string $appName the appName registering the action + * @param string $appId the app ID registering the action * @return ILinkAction */ - public function newLinkAction(string $icon, string $name, string $href, string $appName = ''): ILinkAction; + public function newLinkAction(string $icon, string $name, string $href, string $appId = ''): ILinkAction; /** * Construct and return a new email action for the contacts menu @@ -48,8 +48,8 @@ interface IActionFactory { * @param string $icon full path to the action's icon * @param string $name localized name of the action * @param string $email target e-mail address - * @param string $appName the appName registering the action + * @param string $appId the appName registering the action * @return ILinkAction */ - public function newEMailAction(string $icon, string $name, string $email, string $appName = ''): ILinkAction; + public function newEMailAction(string $icon, string $name, string $email, string $appId = ''): ILinkAction; } diff --git a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php index a2530084442..1f5d37e7483 100644 --- a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php +++ b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php @@ -75,12 +75,12 @@ class LinkActionTest extends TestCase { $this->action->setName('Nickie Works'); $this->action->setPriority(33); $this->action->setHref('example.com'); - $this->action->setAppName('contacts'); + $this->action->setAppId('contacts'); $expected = [ 'title' => 'Nickie Works', 'icon' => 'icon-contacts', 'hyperlink' => 'example.com', - 'appName' => 'contacts', + 'appId' => 'contacts', ]; $json = $this->action->jsonSerialize(); @@ -97,7 +97,7 @@ class LinkActionTest extends TestCase { 'title' => 'Nickie Works', 'icon' => 'icon-contacts', 'hyperlink' => 'example.com', - 'appName' => '', + 'appId' => '', ]; $json = $this->action->jsonSerialize(); |