UPSTREAM BASELINE: nextcloud/spreed v22.0.12 (без изменений)
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled
Источник: https://github.com/nextcloud/spreed/archive/refs/tags/v22.0.12.tar.gz С этого коммита ветка официального Nextcloud Talk отрезана (решение владельца 2026-07-06). Все дальнейшие изменения — только наши; версии релизов: 22.0.12-f7.N.
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\Profile;
|
||||
|
||||
use OCA\Talk\AppInfo\Application;
|
||||
use OCA\Talk\Config;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Profile\ILinkAction;
|
||||
|
||||
class TalkAction implements ILinkAction {
|
||||
private ?IUser $targetUser = null;
|
||||
|
||||
public function __construct(
|
||||
private Config $config,
|
||||
private IL10N $l,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private IUserSession $userSession,
|
||||
) {
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function preload(IUser $targetUser): void {
|
||||
$this->targetUser = $targetUser;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getAppId(): string {
|
||||
return Application::APP_ID;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getId(): string {
|
||||
return 'talk';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getDisplayId(): string {
|
||||
return $this->l->t('Contact via Talk');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getTitle(): string {
|
||||
$visitingUser = $this->userSession->getUser();
|
||||
if (!$visitingUser || $visitingUser === $this->targetUser) {
|
||||
return $this->l->t('Open Talk');
|
||||
}
|
||||
return $this->l->t('Talk to %s', [$this->targetUser->getDisplayName()]);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getPriority(): int {
|
||||
return 10;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getIcon(): string {
|
||||
return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg'));
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getTarget(): ?string {
|
||||
$visitingUser = $this->userSession->getUser();
|
||||
if (
|
||||
!$visitingUser
|
||||
|| $this->config->isDisabledForUser($this->targetUser)
|
||||
|| $this->config->isDisabledForUser($visitingUser)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
if ($visitingUser === $this->targetUser) {
|
||||
return $this->urlGenerator->linkToRouteAbsolute('spreed.Page.index');
|
||||
}
|
||||
return $this->urlGenerator->linkToRouteAbsolute('spreed.Page.index') . '?callUser=' . $this->targetUser->getUID();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user