Skip to content

feat(collaboration): add UserExtraInfo with avatar and mail to CheckFileInfo#2560

Merged
butonic merged 4 commits intoopencloud-eu:mainfrom
pedropintosilva:feat/add-userextrainfo-to-checkfileinfo
Apr 15, 2026
Merged

feat(collaboration): add UserExtraInfo with avatar and mail to CheckFileInfo#2560
butonic merged 4 commits intoopencloud-eu:mainfrom
pedropintosilva:feat/add-userextrainfo-to-checkfileinfo

Conversation

@pedropintosilva
Copy link
Copy Markdown
Contributor

@pedropintosilva pedropintosilva commented Apr 1, 2026

feat(collaboration): add UserExtraInfo with avatar and mail to CheckFileInfo

Add UserExtraInfo (avatar + mail) to the WOPI CheckFileInfo response for
authenticated, non-public-share users.

UserExtraInfo format (per Collabora SDK):
https://sdk.collaboraonline.com/docs/advanced_integration.html#userextrainfo

{
  "avatar": "http://url/to/user/avatar",
  "mail": "user@server.com"
}

After this change, CheckFileInfo returns:

{
  "BaseFileName": "Pedro-filled-hazcom.docx",
  "UserFriendlyName": "Admin",
  "UserId": "346364...39323030",
  "UserCanWrite": true,
  "UserCanRename": true,
  "IsAdminUser": true,
  "EnableInsertRemoteImage": true,
  "EnableInsertRemoteFile": true,
  "EnableOwnerTermination": true,
  "UserExtraInfo": {
    "avatar": "https://host:9300/wopi/avatars/{userID}?access_token={wopiToken}",
    "mail": "admin@example.org"
  },
  "PostMessageOrigin": "https://localhost:9200",
  "message": "CheckFileInfo: success"
}

Avatars are served via a new /wopi/avatars/{userID} endpoint on the
collaboration service, authenticated by the WOPI token. The endpoint
calls the Graph service directly (bypassing the proxy) using the reva
access token via x-access-token header.

All tests pass:
go test ./services/collaboration/... ./services/graph/... ./services/proxy/...

Signed-off-by: Pedro Pinto Silva pedro.silva@collabora.com

@pedropintosilva
Copy link
Copy Markdown
Contributor Author

image

@pedropintosilva pedropintosilva force-pushed the feat/add-userextrainfo-to-checkfileinfo branch from 9bff898 to 454dfdc Compare April 1, 2026 14:24
@pedropintosilva
Copy link
Copy Markdown
Contributor Author

I cannot see what are the specific complains from SonarCloud , I'm not part of the org so, I get some error when attempting to open it in my SonarCloud account.

@rhafer
Copy link
Copy Markdown
Member

rhafer commented Apr 1, 2026

I cannot see what are the specific complains from SonarCloud , I'm not part of the org so, I get some error when attempting to open it in my SonarCloud account.

Yeah, that is really inconvenient. I took a quick look into the complaints and they all where about to much "Cognitive Complexity" (i.e. too deeply nested if/switch statements). SonarCloud is probably right about that, but I've "accepted" those warning for now, since it isn't your changes that introduced the complexity.

Btw, I think you should see the warnings in the annotations here: https://github.com/opencloud-eu/opencloud/pull/2560/changes (I can see them there at least)

Thanks for you contributions, I like it. We still need to take a deeper look into the changes before we can merge them.

@micbar
Copy link
Copy Markdown
Member

micbar commented Apr 7, 2026

@pedropintosilva
First of all, really nice feature! That creates more adoption and "feel good vibes".

I think we need to change the implementation a bit.

You are making the avatar GET Api call an unprotected == public route. That is not possible.

We should implement a dedicated endpoint in the Collaboration service which is authenticated by the WOPI token.
I think we did something similar with the template fetching.

Does Collabora have the possibility to send the WOPI token to the download endpoint?

@pedropintosilva
Copy link
Copy Markdown
Contributor Author

pedropintosilva commented Apr 8, 2026

@pedropintosilva First of all, really nice feature! That creates more adoption and "feel good vibes".

Agreed :)

I think we need to change the implementation a bit.

You are making the avatar GET Api call an unprotected == public route. That is not possible.

You are correct, I was a bit unsure if that's ok (that's why I left that note in the commit message) but at the end I thought would be ok, as anyhow even guests benefit from seeing who they are collaborating with.

We should implement a dedicated endpoint in the Collaboration service which is authenticated by the WOPI token. I think we did something similar with the template fetching.

Does Collabora have the possibility to send the WOPI token to the download endpoint?

Hm I don't think we have we just set the img.src directly: https://github.com/CollaboraOnline/online/blob/main/browser/src/app/LOUtil.ts#L351

but you are right we already have that /wopi/templates/ case so, it would be elegant to have also /wopi/avatars/ and we would still receive the url that we need.

…ileInfo

Add UserExtraInfo (avatar + mail) to the WOPI CheckFileInfo response for
authenticated, non-public-share users.

UserExtraInfo format (per Collabora SDK):
https://sdk.collaboraonline.com/docs/advanced_integration.html#userextrainfo

```json
{
  "avatar": "http://url/to/user/avatar",
  "mail": "user@server.com"
}
```

After this change, CheckFileInfo returns:

```json
{
  "BaseFileName": "Pedro-filled-hazcom.docx",
  "UserFriendlyName": "Admin",
  "UserId": "346364...39323030",
  "UserCanWrite": true,
  "UserCanRename": true,
  "IsAdminUser": true,
  "EnableInsertRemoteImage": true,
  "EnableInsertRemoteFile": true,
  "EnableOwnerTermination": true,
  "UserExtraInfo": {
    "avatar": "https://host:9300/wopi/avatars/{userID}?access_token={wopiToken}",
    "mail": "admin@example.org"
  },
  "PostMessageOrigin": "https://localhost:9200",
  "message": "CheckFileInfo: success"
}
```

Avatars are served via a new /wopi/avatars/{userID} endpoint on the
collaboration service, authenticated by the WOPI token. The endpoint
calls the Graph service directly (bypassing the proxy) using the reva
access token via x-access-token header.

All tests pass:
go test ./services/collaboration/... ./services/graph/... ./services/proxy/...

Signed-off-by: Pedro Pinto Silva <pedro.silva@collabora.com>
@pedropintosilva pedropintosilva force-pushed the feat/add-userextrainfo-to-checkfileinfo branch from 454dfdc to 864e200 Compare April 9, 2026 07:18
@JammingBen JammingBen requested a review from micbar April 9, 2026 09:14
@micbar
Copy link
Copy Markdown
Member

micbar commented Apr 15, 2026

@pedropintosilva Is there a special Collabora version needed?

I have tried this change with collabora/code:25.04.9.4.1 but it doesn't pick up the avatar url.

@micbar
Copy link
Copy Markdown
Member

micbar commented Apr 15, 2026

@pedropintosilva Is there a special Collabora version needed?

I have tried this change with collabora/code:25.04.9.4.1 but it doesn't pick up the avatar url.

Sorry, it is fine. I needed to accept the self signed cert. Now it works.

@micbar
Copy link
Copy Markdown
Member

micbar commented Apr 15, 2026

Where is the email address used?

Copy link
Copy Markdown
Member

@micbar micbar left a comment

Choose a reason for hiding this comment

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

Fine from my POV.

@micbar micbar force-pushed the feat/add-userextrainfo-to-checkfileinfo branch from 1ab82b2 to 35aaf92 Compare April 15, 2026 10:14
@sonarqubecloud
Copy link
Copy Markdown

@micbar micbar requested a review from butonic April 15, 2026 10:16
@pedropintosilva
Copy link
Copy Markdown
Contributor Author

Where is the email address used?

right nowhere, Collabora Online never renders mail, it only passes it through to the integrator and OpenCloud's side doesn't consumes /uses the forwarded postMessage.

But there are few cases where I think we could leverage in the future that email to improve the UX, examples:

  • 2 users display named Pedro -> Show email in user-list tooltips to disambiguate it
  • Extra options such as: "mail this co-editor" action via plain mailto:
  • Presence events/tooltip with a stable identifier ("pedro@… joined")

so I think it's nice to have the field there.

@butonic butonic merged commit 5683e0d into opencloud-eu:main Apr 15, 2026
60 checks passed
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.

4 participants