Skip to content

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

Merged
benjaminfrueh merged 1 commit into
nextcloud:masterfrom
xyonium:feat/approval-requester-placeholder
Oct 16, 2026
Merged

benjaminfrueh merged 1 commit into
nextcloud:masterfrom
xyonium:feat/approval-requester-placeholder

Conversation

@xyonium

@xyonium xyonium commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

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.

@xyonium

xyonium commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Friendly ping @blizzz — now that the companion nextcloud/approval#449 (emitting ApprovalStateChangedEvent with the requester) has been merged into approval's master, this %r placeholder PR is unblocked and ready for review when you get a chance. Branch is freshly rebased/authored (DCO green). Happy to adjust anything you need. Thanks for maintaining this app!

@blizzz

blizzz commented Oct 16, 2026

Copy link
Copy Markdown
Member

Hey @xyonium and thanks for your contribution!

If this pull request is AI assisted, please add a trailer of the format "Assisted-by: AGENT_NAME:MODEL_VERSION" to your commit (cf. https://github.com/nextcloud/.github/blob/master/AI_POLICY.md).

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

Assisted-by: ClaudeCode:kimi-k3
Signed-off-by: xyonium <shark_xc@hotmail.com>
@xyonium
xyonium force-pushed the feat/approval-requester-placeholder branch from 0e6a601 to ff3c5d1 Compare October 16, 2026 10:15
@xyonium

xyonium commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the pointer — done. Added Assisted-by: ClaudeCode:kimi-k3 to the commit per the AI_POLICY.md trailer format (human Signed-off-by retained). Commit ff3c5d1 pushed and DCO is green. Over to you @blizzz whenever you have a moment to review the %r placeholder. The companion nextcloud/approval#449 is already merged, so this is the remaining piece for the approval-requester flow.

@benjaminfrueh
benjaminfrueh merged commit 5798aa6 into nextcloud:master Oct 16, 2026
13 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.

A wildcat to get Approvel Workflow requester's ID

3 participants