Skip to content

Commit af64922

Browse files
Merge pull request #55239 from nextcloud/backport/55196/stable32
[stable32] fix(ocm-invites): add route to invite accept dialog
2 parents 7719f3b + 7155125 commit af64922

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

core/AppInfo/ConfigLexicon.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class ConfigLexicon implements ILexicon {
2828
public const SHARE_LINK_EXPIRE_DATE_ENFORCED = 'shareapi_enforce_expire_date';
2929
public const USER_LANGUAGE = 'lang';
3030
public const OCM_DISCOVERY_ENABLED = 'ocm_discovery_enabled';
31+
public const OCM_INVITE_ACCEPT_DIALOG = 'ocm_invite_accept_dialog';
32+
3133
public const USER_LOCALE = 'locale';
3234
public const USER_TIMEZONE = 'timezone';
3335

@@ -87,6 +89,7 @@ public function getAppConfigs(): array {
8789
),
8890
new Entry(self::LASTCRON_TIMESTAMP, ValueType::INT, 0, 'timestamp of last cron execution'),
8991
new Entry(self::OCM_DISCOVERY_ENABLED, ValueType::BOOL, true, 'enable/disable OCM', lazy: true),
92+
new Entry(self::OCM_INVITE_ACCEPT_DIALOG, ValueType::STRING, '', 'route to local invite accept dialog', lazy: true, note: 'set as empty string to disable feature'),
9093
];
9194
}
9295

lib/private/OCM/Model/OCMProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public function import(array $data): static {
226226
$resources[] = $resource->import($resourceData);
227227
}
228228
$this->setResourceTypes($resources);
229+
$this->setInviteAcceptDialog($data['inviteAcceptDialog'] ?? '');
229230

230231
if (isset($data['publicKey'])) {
231232
// import details about the remote request signing public key, if available
@@ -271,11 +272,11 @@ public function jsonSerialize(): array {
271272
];
272273

273274
$capabilities = $this->getCapabilities();
274-
$inviteAcceptDialog = $this->getInviteAcceptDialog();
275275
if ($capabilities) {
276276
$response['capabilities'] = $capabilities;
277277
}
278-
if ($inviteAcceptDialog) {
278+
$inviteAcceptDialog = $this->getInviteAcceptDialog();
279+
if ($inviteAcceptDialog !== '') {
279280
$response['inviteAcceptDialog'] = $inviteAcceptDialog;
280281
}
281282
return $response;

lib/private/OCM/OCMDiscoveryService.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ public function getLocalOCMProvider(bool $fullDetails = true): ICapabilityAwareO
152152
$provider->setEndPoint(substr($url, 0, $pos));
153153
$provider->setCapabilities(['/invite-accepted', '/notifications', '/shares']);
154154

155+
// The inviteAcceptDialog is available from the contacts app, if this config value is set
156+
$inviteAcceptDialog = $this->appConfig->getValueString('core', ConfigLexicon::OCM_INVITE_ACCEPT_DIALOG);
157+
if ($inviteAcceptDialog !== '') {
158+
$provider->setInviteAcceptDialog($this->urlGenerator->linkToRouteAbsolute($inviteAcceptDialog));
159+
}
160+
155161
$resource = $provider->createNewResourceType();
156162
$resource->setName('file')
157163
->setShareTypes(['user', 'group'])

0 commit comments

Comments
 (0)