Skip to content

feat: Add the possibility to create invitation links to circles#2254

Open
Koc wants to merge 1 commit into
masterfrom
feature/invitation-links-to-circles
Open

feat: Add the possibility to create invitation links to circles#2254
Koc wants to merge 1 commit into
masterfrom
feature/invitation-links-to-circles

Conversation

@Koc

@Koc Koc commented Nov 29, 2025

Copy link
Copy Markdown
Contributor

This PR adds possibility to generate invitation link (even for completely hidden/closed Circles). Any user is able to join to the circle by opening this link.

Dependencies

@Koc Koc force-pushed the feature/invitation-links-to-circles branch 13 times, most recently from 8301408 to a89bf72 Compare November 30, 2025 22:40
@Koc Koc force-pushed the feature/invitation-links-to-circles branch 3 times, most recently from baffcc3 to af15456 Compare December 7, 2025 13:19
@Koc Koc marked this pull request as ready for review December 7, 2025 13:26
@Koc Koc requested a review from ArtificialOwl December 7, 2025 13:27
@Koc Koc force-pushed the feature/invitation-links-to-circles branch from af15456 to 018eea9 Compare April 16, 2026 09:12
@Koc Koc force-pushed the feature/invitation-links-to-circles branch from 018eea9 to 08b6110 Compare May 4, 2026 14:09
@Koc Koc force-pushed the feature/invitation-links-to-circles branch 2 times, most recently from 213cfc1 to b01cd7a Compare June 9, 2026 19:16
Comment thread lib/Model/CircleInvitation.php Outdated
$initiatorHelper = new MemberHelper($circle->getInitiator());
$initiatorHelper->mustBeAdmin();

$new = clone $circle;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it needed to clone the circle object?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just inspired from already existent verify method implementations:

*
* @throws InvalidIdException
*/
public function replace(CircleInvitation $circleInvitation): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could there be multiple invitation per circle? If so, shouldn't we delete a specific invitation, and not all of them?

@Koc Koc Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not now. In theory we can add that, but in this case we need rework UI and introduce something like "invitation link name" to distinguish links.

I would like to start with something really simple and improve it later

Comment thread lib/Db/CircleInvitationRequest.php Outdated
Comment thread lib/Db/CircleRequest.php
$qb->limitToInitiator(CoreQueryBuilder::CIRCLE, $initiator);
$qb->orderBy($qb->generateAlias(CoreQueryBuilder::CIRCLE, CoreQueryBuilder::INITIATOR) . '.level', 'desc');
$qb->addOrderBy(CoreQueryBuilder::CIRCLE . '.display_name', 'asc');
$qb->leftJoinCircleInvitation(CoreQueryBuilder::CIRCLE);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we join only if $probe->hasInvitationCode() === true?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, because we need to respond with invitationCode in GET https://nextcloud.test/ocs/v2.php/apps/circles/circles endpoint

image

Comment thread lib/Db/CircleRequestBuilder.php Outdated
/**
* @return CoreQueryBuilder&IQueryBuilder
*/
protected function getCircleInvitationInsertSql(): CoreQueryBuilder {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to getCircleInvitationDeleteSql, we should inline the content of this method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inlined

Comment thread lib/Service/CircleService.php Outdated
@Koc Koc force-pushed the feature/invitation-links-to-circles branch 2 times, most recently from bac0d4e to 524ff22 Compare June 28, 2026 10:56
@Koc Koc requested a review from mejo- June 28, 2026 11:08
@Koc Koc force-pushed the feature/invitation-links-to-circles branch from 524ff22 to 63d11c0 Compare June 28, 2026 11:16
@Koc Koc requested a review from provokateurin as a code owner June 28, 2026 11:16
@Koc Koc force-pushed the feature/invitation-links-to-circles branch from 63d11c0 to 23a9469 Compare June 28, 2026 11:21
@Koc

Koc commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Error: lib/FederatedItems/CircleCreateInvitation.php:47:36: DeprecatedMethod: The method OCP\Security\ISecureRandom::generate has been marked as deprecated (see https://psalm.dev/001)

  • @deprecated 35.0.0 Use {@see Randomizer::getBytesFromString()} available in PHP 8.3+ instead.

I can't use Randomizer as module still relies on PHP 8.1

@Koc Koc force-pushed the feature/invitation-links-to-circles branch 2 times, most recently from cb5808c to c1227d7 Compare June 28, 2026 12:30
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
@Koc Koc force-pushed the feature/invitation-links-to-circles branch from c1227d7 to ab2ab91 Compare June 28, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants