mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 22:27:31 -04:00
Change origin field to appId
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
5e23800a95
commit
7f1dc52a66
7 changed files with 25 additions and 33 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue