Skip to content

[feature] Add target_url_suffix for notification target URLs #492

Description

@nemesifier

Is your feature request related to a problem? Please describe.

We need a way to append a querystring or fragment to a notification target URL, especially for generic_message notifications, without allowing callers to override the full URL.

Describe the solution you'd like

Add a target_url_suffix argument to notify.send, for example:

notify.send(
    type="generic_message",
    sender=obj,
    target=obj,
    target_url_suffix="?status=pending",
)

The suffix should be appended in the notification model when resolving target_url. It should also support fragments, for example target_url_suffix="#pending".

Invalid values should raise ValueError when passed to notify.send. Valid suffixes should start with ?, &, or #.

Describe alternatives you've considered

Using the existing notification type target_link mechanism works for dedicated notification types, but it is type-level and not suitable for per-notification generic_message usage.

Allowing a full URL override is too broad for this use case.

Additional context

The goal is to keep the feature narrow and model-centered: generate the existing target URL as usual, then append the validated suffix.

Originally needed in openwisp/openwisp-firmware-upgrader#436.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Fields

No fields configured for Feature.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions