Skip to content

Show which note is locked and how to unlock it - #3422

Open
NostalgiaRealm wants to merge 2 commits into
nextcloud:mainfrom
NostalgiaRealm:fix/sync-locked-note-message
Open

NostalgiaRealm wants to merge 2 commits into
nextcloud:mainfrom
NostalgiaRealm:fix/sync-locked-note-message

Conversation

@NostalgiaRealm

@NostalgiaRealm NostalgiaRealm commented Nov 3, 2026 •

Copy link
Copy Markdown

I ran into this on my personal nextcloud: 7 notes were “Locked” with no editor open, the oldest since 2026-09-08. These locks make the Notes API return HTTP 423.

Notes Android 35.0.0 shows {"errorType":"Exception"}. Current main says “A note is open in another app. Close it there to sync your changes.” Neither identifies the note, and closing an app doesn’t help when nothing has it open.

This change makes the error more useful:

  • NoteSyncException exposes the note title, and SyncErrorMessage returns formatted text instead of a resource ID.
  • One locked note shows: ““<title>” is locked on the server. Close it in the other app, or unlock it in the web interface.”
  • Multiple notes show “ notes are locked on the server.” with the same advice. HTTP 423 without a known note gets a generic version.
  • TipsAdapter adds two tips: close the note in Text/another app, or clear a stale lock through the web interface under Files → menu → Unlock, with administrator help if needed.
    Following CONTRIBUTING, the wording change replaces error_sync_locked with error_sync_unknown_note_locked. Added error_sync_note_locked, error_sync_notes_locked, error_dialog_tip_note_locked_close and error_dialog_tip_note_locked_unlock.

I reproduced this on my phone using Nextcloud 35.0.2, files_lock 35.0.1 and Text 9.0.1. Opening a .md note through Files Android’s TextEditorWebView and closing it with X left an oc_files_lock entry behind: owner “Text”, type 1, TTL -60. Nobody had the note open, but every subsequent push from Notes returned HTTP 423.

A manual “Lock file” lock set by my own user did not block my own Notes sync. Text app locks and other users’ locks did. In this setup, Files Android’s action sheet only showed “Locked by …”, without an Unlock action; unlocking was available in the web interface.

I tested both main and this branch on my phone and captured:

  • before-snackbar.png: main, 35.20.0 Alpha 01, dev flavor, showing the existing message on HTTP 423.
before-snackbar
  • after-snackbar.png: the branch in the same situation, identifying “Lock test” and explaining how to unlock it.
after-snackbar
  • after-dialog.png: the branch’s More dialog with both new tips.
    There’s no before-dialog screenshot: main only shows the technical details there, with no lock-specific guidance.
after-dialog

This doesn’t add a list badge, prevent editing locked notes or provide in-app unlocking. I verified that the owner can clear a Text app lock using DELETE /ocs/v2.php/apps/files_lock/lock/{fileId} with X-User-Lock-Type: 1 on Nextcloud 35.0.2 / files_lock 35.0.1. That would address the “Ideally” part of #3387, but I’d like maintainer input first.

The lock remaining after closing the editor and the missing Android Unlock action are possible follow-ups for nextcloud/text and nextcloud/android.

Checks on 2026-11-03 with Temurin 21:

  • ./gradlew :app:testGenericDebugUnitTest --tests it.niedermann.owncloud.notes.main.SyncErrorMessageTest - all 5 new Kotlin/Robolectric tests passed.
  • ./gradlew :app:lintGenericDebug - BUILD SUCCESSFUL, no findings in changed files.

Relates to #3387 (minimum part: tell the user which note is locked + how to unlock it). Same symptom reported in #2332 and #3420.

AI-assistant: Claude Code 2.1.309 (Claude Fable 5.1)

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@codacy-production

codacy-production Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 13 complexity · 0 duplication

Metric Results
Complexity 13
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

When the server answers 423 Locked for a note, the sync message only said
that "a note is open in another app". In practice the lock is often a stale
Files Lock entry left behind by the Text app, the note is not open anywhere,
and the user cannot tell which note is affected or what to do.

The sync error now names the locked note (or counts them), tells the user to
close it in the other app or unlock it in the web interface, and the error
dialog gets two tips with the concrete steps.

Relates to nextcloud#3387, nextcloud#2332, nextcloud#3420

AI-assistant: Claude Code 2.1.309 (Claude Fable 5.1)
Signed-off-by: Rick van den Bergh <info@nostalgiarealm.com>
@NostalgiaRealm
NostalgiaRealm force-pushed the fix/sync-locked-note-message branch from 6d4c9ad to f9ad223 Compare November 3, 2026 01:43
@NostalgiaRealm
NostalgiaRealm marked this pull request as ready for review November 3, 2026 01:46
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.

1 participant