Skip to content

Backport: cool#15364 wsd, kit, browser: honour the Viewing/Editing toggle acros…#15764

Merged
eszkadev merged 1 commit into
distro/collabora/co-25.04from
private/eszkadev/backport-readonly
May 15, 2026
Merged

Backport: cool#15364 wsd, kit, browser: honour the Viewing/Editing toggle acros…#15764
eszkadev merged 1 commit into
distro/collabora/co-25.04from
private/eszkadev/backport-readonly

Conversation

@eszkadev
Copy link
Copy Markdown
Contributor

…s the session

Problem: switching to Viewing mode only updated the browser UI. The view stayed editable in core, so shape drags and arrow-key shape moves still went through, and per-comment Edit/Reply/Delete controls were only hidden at comment-render time so existing comments kept showing them until reloaded.

Solution: when a WOPI-writable user toggles between Viewing and Editing, send a new setviewreadonly message to core so the view is marked read-only there too, and flip the client-side comment/redline flags so the UI reacts immediately. Build the comment menu once and show or hide it reactively on updatepermission, instead of tying its creation to the initial permission.

Code pointers:

  • Permission.js: sends setviewreadonly and updates app.file flags (gated on wopi.UserCanWrite to avoid breaking comment-only PDFs).
  • ClientSession.cpp / ChildSession.cpp: forward and handle the new message; kit calls setViewReadOnly + setAllowChangeComments + setAllowManageRedlines for the current view.
  • CommentSection.ts: updateEditability() listens on updatepermission and toggles menuBarCell / edit / reply panels; cleaned up in onRemove.

requires: https://gerrit.collaboraoffice.com/c/core/+/2530
copy of: https://gerrit.collaboraoffice.com/c/online/+/2531

@eszkadev
Copy link
Copy Markdown
Contributor Author

eszkadev commented May 14, 2026

fails on known to fail cases (I will fix in other PR -> #15758)

@eszkadev eszkadev enabled auto-merge (rebase) May 14, 2026 05:28
@eszkadev
Copy link
Copy Markdown
Contributor Author

merged in gerrit

…s the session

Problem: switching to Viewing mode only updated the browser UI. The view stayed editable in core, so shape drags and arrow-key shape moves still went through, and per-comment Edit/Reply/Delete controls were only hidden at comment-render time so existing comments kept showing them until reloaded.

Solution: when a WOPI-writable user toggles between Viewing and Editing, send a new setviewreadonly message to core so the view is marked read-only there too, and flip the client-side comment/redline flags so the UI reacts immediately. Build the comment menu once and show or hide it reactively on updatepermission, instead of tying its creation to the initial permission.

Code pointers:
- Permission.js: sends setviewreadonly and updates app.file flags (gated on wopi.UserCanWrite to avoid breaking comment-only PDFs).
- ClientSession.cpp / ChildSession.cpp: forward and handle the new message; kit calls setViewReadOnly + setAllowChangeComments + setAllowManageRedlines for the current view.
- CommentSection.ts: updateEditability() listens on updatepermission and toggles menuBarCell / edit / reply panels; cleaned up in onRemove.

Signed-off-by: Darshan-upadhyay1110 <darshan.upadhyay@collabora.com>
Change-Id: I4f57a4efc08d163930cdf1716bf836dce3f620cb
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1252
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
@eszkadev eszkadev force-pushed the private/eszkadev/backport-readonly branch from bca709d to ac362ea Compare May 14, 2026 07:45
@eszkadev
Copy link
Copy Markdown
Contributor Author

@timar can we merge now?

Copy link
Copy Markdown
Contributor

@quikee quikee left a comment

Choose a reason for hiding this comment

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

Looks ok to me

@eszkadev eszkadev merged commit 0945090 into distro/collabora/co-25.04 May 15, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from To Review to To Test in Collabora Online May 15, 2026
@eszkadev eszkadev deleted the private/eszkadev/backport-readonly branch May 15, 2026 07:19
@github-project-automation github-project-automation Bot moved this from To Test to Done in Collabora Online May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants