dgtlmoon / dgtlmoon/changedetection.io

Token "restock" not valid in system-wide notification settings after updating

Open
#2,880 3 comments 0 reactions 1 assignee Claimed by @dgtlmoon View on GitHub
triage
Dominant language
Python
Stars
34.1k
Forks
2k
Avg merge
23h 38m
Merged PRs (30d)
67

Description

**Describe the bug**
After updating from a couple months old version (sorry, can't remember which), trying to save system-wide notification settings while either notification title or body uses the token `restock` prevents from saving settings while also showing the error message below:

`The following tokens used in the notification are not valid: restock`

If using a restock property directly without checking if `restock` exists, for example a message composed of just `{{ restock.price }}`, the error is:

`A variable or function is not defined: 'restock' is undefined`

When editing settings for a specific watch of type "Re-stock & Price detection", the token is accepted.

**Version**
v0.48.05

**How did you install?**
Docker

**To Reproduce**
1. Go to settings > notifications
2. Write the example value below In the notification body field:
- `{% if restock %}From $ {{restock.original_price}} to $ {{restock.price}}{% else %}{{diff}}{% endif %}`
3. Save
4. An error occurs and the settings aren't saved

**Expected behavior**
Token should be accepted and settings should be saved, as it worked a few versions ago.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.