Skip to content

feat(invite-email): make OCM invite email optional and improve UI#14

Open
MahdiBaghbani wants to merge 2 commits into
sara-nl:invite-for-cloudid-exchangefrom
MahdiBaghbani:mahdi/fix/ui-optional-email
Open

feat(invite-email): make OCM invite email optional and improve UI#14
MahdiBaghbani wants to merge 2 commits into
sara-nl:invite-for-cloudid-exchangefrom
MahdiBaghbani:mahdi/fix/ui-optional-email

Conversation

@MahdiBaghbani
Copy link
Copy Markdown

@MahdiBaghbani MahdiBaghbani commented Nov 29, 2025

OCM Invites: Optional Email and UI Improvements

Email is Now Optional

The backend was already set up to handle NULL emails (thanks, database schema!), but the code was still checking for it. Now you can create invites without email, perfect for when you just want to share a link manually. (in my case test suite)

Invite Labels

Now there's an optional label field so you can tag invites with something like "Giuseppe from CERN" or "Test invite for demo". Makes searching way easier, especially for link-only invites.
I just reused the existing recipient_name column, so no database migrations needed. until the invite accepted by remote the label lives there, after it would be replaced by the actual name returned by remote

UI

  • Better spacing and layout
  • Added a checkbox for "Send invite via email", email fields only appear when you check it
  • Clear hint text about what happens if you skip email

The invite details page :

  • Just the essential info, no redundant input fields
  • Three handy copy buttons in a grid: invite link, token, and base64

Everything is backward compatible, existing invites with email work exactly like before. No breaking changes here as far as I've tested, if you test it on the SUNET test drive it would be great!

Gallery

Pop up changes, email toggle, invalid or not configured smtp error, etc

Screenshot 2025-11-30 112601 Screenshot 2025-11-30 112637 Screenshot 2025-11-30 112618 Screenshot 2025-11-30 112649

Creating a test invite with no email

Screenshot 2025-11-30 112709 Screenshot 2025-11-30 112724

@MahdiBaghbani
Copy link
Copy Markdown
Author

Hi @redblom and @mickenordin, I've been tinkering with the app a bit, could you take a look at my changes when you have a moment?

Copy link
Copy Markdown

@mickenordin mickenordin left a comment

Choose a reason for hiding this comment

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

I like it!

@redblom
Copy link
Copy Markdown
Collaborator

redblom commented Dec 1, 2025

This could be the opportunity to also add the 'Cc invite to sender' option/checkbox when sending an invite.

@redblom
Copy link
Copy Markdown
Collaborator

redblom commented Dec 1, 2025

There are now discrepancies in terminology regarding token, invite link, (base64) between the create invite and accept invite form. That must be fixed.

@redblom
Copy link
Copy Markdown
Collaborator

redblom commented Dec 1, 2025

Can the 'optional message' field become a multi-line text field again?

@MahdiBaghbani
Copy link
Copy Markdown
Author

MahdiBaghbani commented Dec 1, 2025

This could be the opportunity to also add the 'Cc invite to sender' option/checkbox when sending an invite.

I'm not sure what this is, Cc to who? like I, as an invite creator send an email to the recipient of invite and also myself?

There are now discrepancies in terminology regarding token, invite link, (base64) between the create invite and accept invite form. That must be fixed.

Yes, I feel this too, we can discuss about this

  1. plain invite token is the opaque@fqdn
  2. base64 invite token base64(opaque@fqdn) (imo, I don't like it, but this was added to oCIS, OpenCloud)
  3. WAYF link, which is a bit too technical, so Micke mentioned to change it, so I named it invite link.

Can the 'optional message' field become a multi-line text field again?

Yes, I can make it multi line again

@redblom
Copy link
Copy Markdown
Collaborator

redblom commented Dec 2, 2025

This could be the opportunity to also add the 'Cc invite to sender' option/checkbox when sending an invite.

I'm not sure what this is, Cc to who? like I, as an invite creator send an email to the recipient of invite and also myself?

Yes, send the invite also to myself (ie. the inviter). So just a checkbox something like this:

  • Also send copy of the invite to myself

@MahdiBaghbani
Copy link
Copy Markdown
Author

MahdiBaghbani commented Dec 6, 2025

Simple Mode

Screenshot 2025-12-06 141052

I didn't have SMTP so I cannot see the next page :-) If you can test it on SUNET test and see how it looks would be great @mickenordin

Screenshot 2025-12-06 141130

Advanced Mode

Screenshot 2025-12-06 130908 Screenshot 2025-12-06 130938

Trying to add a share while the email checkbox is on and the email filed is empty
Screenshot 2025-12-06 134815

Re designed the copy section and add a bit of explanation for "non-technical" people, I think this part needs some polishing anyway

Screenshot 2025-12-06 135828

Manual accept form

Screenshot 2025-12-06 135846
  1. Fixed the text here a little bit, and tried to keep it understandable by anyone
  2. Also make sure that this filed can accept anything even the WAYF link itself!
    So when the user accidentally pastes WAYF URL into this box, it will try to find token and provider in that URL string and do the acceptance, if all measures fail, give a proper error message
  3. even on basic mode (no encoded token copy mechanism), this box is able to accept and decode the base64 ones (same as before) so I've clarified that in the text as well

I've decided to make it more configurable like this:

occ config:app:set contacts ocm_invites_optional_mail --value=0|1
occ config:app:set contacts ocm_invites_cc_sender --value=0|1
occ config:app:set contacts ocm_invites_encoded_copy_button --value=0|1

@redblom I have implemented the changes we discussed (including the updated wording for the invite details). When you have a moment, could you please take another look and let me know what you think?

@redblom redblom force-pushed the invite-for-cloudid-exchange branch from 280c35f to 7a8cc14 Compare January 13, 2026 08:41
@redblom redblom force-pushed the invite-for-cloudid-exchange branch 2 times, most recently from d6a02e3 to 9b66ad3 Compare January 26, 2026 07:52
@redblom redblom force-pushed the invite-for-cloudid-exchange branch from a5432b0 to aed6433 Compare February 3, 2026 14:41
@redblom redblom force-pushed the invite-for-cloudid-exchange branch from aed6433 to 299aea5 Compare February 18, 2026 11:24
@redblom
Copy link
Copy Markdown
Collaborator

redblom commented Apr 7, 2026

@MahdiBaghbani - can you rebase and squash maybe ?

@redblom redblom force-pushed the invite-for-cloudid-exchange branch 2 times, most recently from 3984fd6 to a4ce368 Compare April 8, 2026 14:56
@MahdiBaghbani MahdiBaghbani force-pushed the mahdi/fix/ui-optional-email branch 5 times, most recently from 952e001 to 84ae6e9 Compare April 9, 2026 11:56
@redblom
Copy link
Copy Markdown
Collaborator

redblom commented Apr 10, 2026

@MahdiBaghbani - tested locally and came up with the recommendations below.
Looks great btw. 👍
ps. I'm pushing for merges of this and the required server code. Hopefully soon now.

New Invite:

The email_optional flag:

  • if set to false the email_optional checkbox is not visible. But if we don't specify an email in the invite form the current message still reads: Please enter an email address or uncheck "Send invite via email".
    It should just read: Please enter an email address.

The email:

  • Optional personal message is missing in the email sent (apparently it's not set anymore in the frontend).

Accept invite forms (popup & manual):

  • Explanatory messages on these two forms should be aligned. They have diverged.
    Proposal for both forms:
    • Header: Accept invite to exchange contact info.
    • Explanatory message:
      Accepting will add the inviter to your contacts list and in return, your contact info will be sent to the inviter.
      From there on you can start sharing data with each other.

Accept invite form (manual):

  • the helper and label texts of the input field should match.

All invites list:

  • An invite that has been send by email, and can be resend ('Resend mail' button visible), also shows the 'Copy invite link&code' buttons. I'm not sure this is useful here.
  • For invites that have not been sent by email the 'Sent to' field reads: No email (link-only)
    I think we can remove (link-only). Or indeed, the whole 'Sent to' row.

Settings:

  • maybe create commands for the new config settings

@MahdiBaghbani
Copy link
Copy Markdown
Author

MahdiBaghbani commented Apr 10, 2026

OK! glad you liked it.
I have a bit of a problem over here; I'll try to sort things out early next week and ask for review again.
BTW, you mean pushing to merge this nextcloud#4417 ? It would be cool!

@redblom
Copy link
Copy Markdown
Collaborator

redblom commented Apr 10, 2026

OK! glad you liked it. I have bit of problems over here, I'll try to sort things out early next week and ask for review again.

If you can manage, great, else just give a shout and I can try to do it.

BTW, you mean pushing to merge this nextcloud#4417 ? It would be cool!

Yes! It belongs in there :)

@MahdiBaghbani MahdiBaghbani force-pushed the mahdi/fix/ui-optional-email branch 4 times, most recently from d27eef7 to bdc4766 Compare April 18, 2026 13:59
@MahdiBaghbani MahdiBaghbani force-pushed the mahdi/fix/ui-optional-email branch 5 times, most recently from ab8337b to 6c6e79f Compare April 18, 2026 23:12
@MahdiBaghbani
Copy link
Copy Markdown
Author

MahdiBaghbani commented Apr 19, 2026

@redblom I know I'm taking more than a week to wrap things up 😃 sorry to keep you waiting!

I tried implementing some of @artonge reviews as well.

This is almost ready but needs a bit more edits

@redblom
Copy link
Copy Markdown
Collaborator

redblom commented May 8, 2026

@MahdiBaghbani - I managed to merge your work but had to revert some things because it did not seem to work properly. Nothing feature wise though, that's all in there !

ps. Can you make sense of https://github.com/nextcloud/contacts/pull/4417/changes#r3087711741 ?

@redblom redblom force-pushed the invite-for-cloudid-exchange branch from e78bd65 to 55dafdf Compare May 8, 2026 14:25
@MahdiBaghbani
Copy link
Copy Markdown
Author

@redblom Hi Antoon, sorry for delay :-(

I'm back home and want to work on this in the weekend till morning, I have lots of uncommitted changes in local, is there anything I should know about the force push you did? anything I should adapt myself into?

…ion workflow

see https://github.com/cs3org/OCM-API/blob/v1.2.1/IETF-RFC.md

Features:
 - Button to invite remote users to exchange cloudIDs.
 - Button to manually accept invite to exchange cloudIDs.
 - WAYF page allowing the receiver of the invite to open and accept the invitation.
 - Listing of open invitations.
 - Option to resend, revoke open invitations.

Signed-off-by: Antoon P. <antoon.prins@surf.nl>
Co-authored-by: Micke Nordin <kano@sunet.se>
Co-authored-by: Mahdi Baghbani <mahdi-baghbani@azadehafzar.io>
@redblom redblom force-pushed the invite-for-cloudid-exchange branch from 55dafdf to e05f396 Compare May 8, 2026 18:44
@redblom
Copy link
Copy Markdown
Collaborator

redblom commented May 8, 2026

@redblom Hi Antoon, sorry for delay :-(

I'm back home and want to work on this in the weekend till morning, I have lots of uncommitted changes in local, is there anything I should know about the force push you did? anything I should adapt myself into?

Hi @MahdiBaghbani,
Hope your ok.

First of all, I just pushed again because I realized I pushed from the wrong branch (ahum).

Anyway, I wasn't sure about your circumstances so I did the best I could and pushed that.
If you could please start from what I pushed now then the next merge should be easier.
Then I'll continue on Monday. Good luck :)
ps. any chance to have a call next week?

@MahdiBaghbani
Copy link
Copy Markdown
Author

MahdiBaghbani commented May 8, 2026

Hope your ok.

Thanks!

If you could please start from what I pushed now then the next merge should be easier.

Yes, I'll do it, getting through my unfinished work right now, is there anything significant to the OCM contacts have changed or just some small stuff?

ps. any chance to have a call next week?

Yes, on Monday we can talk (I hope it connects; Internet isn't exactly connected here), although the video probably doesn't work for me so you would only have my voice :-)

@MahdiBaghbani
Copy link
Copy Markdown
Author

artonge was objecting to contacts app importing private OC\Core\AppInfo\ConfigLexicon

while the (my) local branch avoids that import now but still uses the core/ocm_invite_accept_dialog app-config key because server-side OCM discovery expects that key

If we want to fully satisfy the review literally, we need either a contacts app owned setting mirrored into the core key, or a server public mechanism so contacts app can provide the invite-accept dialog without changing core private config surface

Correct me if you feel I get his intention wrong

@MahdiBaghbani MahdiBaghbani force-pushed the mahdi/fix/ui-optional-email branch from 6c6e79f to 753d568 Compare May 8, 2026 23:12
@MahdiBaghbani
Copy link
Copy Markdown
Author

I restarted from what you pushed and squashed my side back into one cleaned commit

I also looked again at the artonge comment. I think the correct interpretation is that Contacts should not import Core's private OC\Core\AppInfo\ConfigLexicon, but we still need to write the existing core/ocm_invite_accept_dialog app-config key because current server-side OCM discovery reads that key to advertise the invite accept dialog.

So, the updated branch keeps the key, removes the private Core class dependency, and aligns the discovery/accept flow with the current server contract.

* Listens to the federated invite accepted event.
* Catching the event should lead to the creation of the new remote contact
* from the invite, in the inviter's address book.
*
Copy link
Copy Markdown
Collaborator

@redblom redblom May 11, 2026

Choose a reason for hiding this comment

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

This does not work anymore. The event dispatched is OCMEndpointRequestEvent. See https://github.com/sara-nl/nextcloud-contacts/blob/invite-for-cloudid-exchange/lib/Listener/FederatedInviteAcceptedListener.php.
I delegated acceptance and contact creation to FederatedInvitesService.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have been working on this

Also as per OCM spec the email in payload is required not optional so that has to be fixed too

Comment thread lib/Command/DisableOcmInvites.php Outdated
Copy link
Copy Markdown
Collaborator

@redblom redblom May 11, 2026

Choose a reason for hiding this comment

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

A suggestion from NC was to remove these commands that set only one parameter and people can simply use occ config:app:set {appid} {param} --value {value} --type {type} (nextcloud#4417 (comment)).
I think it makes sense.
Maybe we can put everything into OcmInvitesConfig ?

@MahdiBaghbani MahdiBaghbani force-pushed the mahdi/fix/ui-optional-email branch from 753d568 to bd03178 Compare May 11, 2026 12:07
@redblom
Copy link
Copy Markdown
Collaborator

redblom commented May 11, 2026

@MahdiBaghbani - the unit tests are fine now !

Signed-off-by: Mahdi Baghbani <mahdi-baghbani@azadehafzar.io>
@MahdiBaghbani MahdiBaghbani force-pushed the mahdi/fix/ui-optional-email branch from bd03178 to ae52203 Compare May 12, 2026 11:43
@MahdiBaghbani
Copy link
Copy Markdown
Author

I re checked the inviteAcceptDialog handling against the OCM spec and the paired server change

Contacts still advertise the invite accept dialog in OCM discovery, but it no longer writes the old core/ocm_invite_accept_dialog app-config bridge

Instead, the Contacts discovery listener adds the invite-accepted capability and sets inviteAcceptDialog directly on the LocalOCMDiscoveryEvent provider, matching the ownership model from nextcloud/server#57853

I also folded the old one-off occ commands into contacts:ocm-invites-config, so OCM invite settings are managed through one command instead of separate enable/disable/config commands

I believe that setting the accept dialog in the OCM discovery should be synced with the enable disable of the invites mechanism since if you disable it and then keep advertising it then the discovery would be lying to the remote EFSS systems

I hope you can verify my changes against the server branch of yours since I couldn't really do the live test

#[\Override]
protected function configure(): void {
$supportedOptions = implode(', ', $this->getSupportedOptions());
$help = <<<HELP
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Decide to keep this or remove this, I figured maybe a help would be helpful 😄

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes. What would be nice is to have an explanation for each setting, what it's for.
Either in this text or per setting.
I'm trying to figure out if that's possible.

@redblom
Copy link
Copy Markdown
Collaborator

redblom commented May 12, 2026

I re checked the inviteAcceptDialog handling against the OCM spec and the paired server change

Contacts still advertise the invite accept dialog in OCM discovery, but it no longer writes the old core/ocm_invite_accept_dialog app-config bridge

Instead, the Contacts discovery listener adds the invite-accepted capability and sets inviteAcceptDialog directly on the LocalOCMDiscoveryEvent provider, matching the ownership model from nextcloud/server#57853

I also folded the old one-off occ commands into contacts:ocm-invites-config, so OCM invite settings are managed through one command instead of separate enable/disable/config commands

I believe that setting the accept dialog in the OCM discovery should be synced with the enable disable of the invites mechanism since if you disable it and then keep advertising it then the discovery would be lying to the remote EFSS systems

I hope you can verify my changes against the server branch of yours since I couldn't really do the live test

So, I assume that I should remove the core ocm OCM_INVITE_ACCEPT_DIALOG key in nextcloud/server#57853 because only implementers of the invitation workflow (eg. the contacts app) will actually set the the inviteAcceptDialog field in the discovery response.

@MahdiBaghbani
Copy link
Copy Markdown
Author

Yes, I think that is the correct thing to do.

I checked both sides again. With nextcloud/server#57853, the server no longer owns the invite-accepted implementation and no longer reads core/ocm_invite_accept_dialog in OCMDiscoveryService.

The Contacts app now registers the invite-accepted capability and sets inviteAcceptDialog directly on the LocalOCMDiscoveryEvent provider.

So the OCM discovery field is still needed, but the core app-config key is no longer needed in this design.

It was only a bridge for the old server-owned discovery behavior. The only thing to keep in mind is that Contacts now depends on the server-side getProvider() API on LocalOCMDiscoveryEvent, so that API needs to exist in whichever server branch this is targeting.

@redblom
Copy link
Copy Markdown
Collaborator

redblom commented May 12, 2026

So the OCM discovery field is still needed, but the core app-config key is no longer needed in this design.

Yes

@redblom redblom force-pushed the invite-for-cloudid-exchange branch 3 times, most recently from 9b4f002 to 5b70cba Compare May 15, 2026 11:23
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.

3 participants