Skip to content

feat: add %r placeholder for the approval requester - #534

Open
xyonium wants to merge 1 commit into
nextcloud:masterfrom
xyonium:feat/approval-requester-placeholder
Open

xyonium wants to merge 1 commit into
nextcloud:masterfrom
xyonium:feat/approval-requester-placeholder

Conversation

@xyonium

@xyonium xyonium commented Sep 27, 2026

Copy link
Copy Markdown

Fixes #363 — requires the approval app counterpart: nextcloud/approval#449

What this does

Adds a %r placeholder that is substituted with the user id of the approval requester.

When a flow rule reacts to the approval app's tag assignments, the existing placeholders cannot provide the requester: %a resolves to the approver on approve/reject and %o to the file owner. The approval app emits an ApprovalStateChangedEvent carrying the requester right before it (un)assigns its tags (see the linked approval PR).

Since the workflow engine reacts to the tag change synchronously within the same request, the new ApprovalStateChangedListener stores the requester in the request-scoped RequesterContext, and buildCommand() substitutes %r from there.

Behavior notes

  • If the approval app is not installed (or does not emit the event yet), the listener registration is by class name and simply never fires — nothing breaks.
  • If no requester is known for the file (e.g. the flow was not triggered by an approval state change), substitution fails with PlaceholderNotSubstituted: the command is not executed and a warning is logged, consistent with %n.
  • %r is also substituted on approval requests (pending tag), where it usually matches %a, but also covers (auto-)tagging scenarios without a session user.

The README placeholder table is updated accordingly.

When a flow reacts to a tag assignment of the approval app, the actor
placeholder %a resolves to the approver on approval and rejection,
while scripts typically need to act for the user who requested the
approval (e.g. move the file into their space).

The approval app emits an ApprovalStateChangedEvent carrying the
requester right before changing its tags. The new listener stores it
in the request-scoped RequesterContext, so it is substituted when the
workflow engine reacts to the tag change within the same request. When
no requester is known, the command is not executed and a warning is
logged, consistent with the %n placeholder.

Requires the approval app to emit the event, see
nextcloud#363

Signed-off-by: eli <shark_xc@hotmail.com>
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.

A wildcat to get Approvel Workflow requester's ID

1 participant