Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions changedetectionio/blueprint/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ def _handle_operations(op, uuids, datastore, worker_pool, update_q, queuedWatchM
datastore.set_last_viewed(uuid, int(time.time()))
result_message = gettext("{} watches updated").format(len(uuids))

elif (op == 'mark-unviewed'):
# Re #4382 - wind last_viewed back to the second-newest snapshot, so the row is unviewed
# again and [diff] still opens on the latest change (see get_from_version_based_on_last_viewed).
# With fewer than two snapshots there is no change to un-view, so those are skipped.
updated = 0
for uuid in uuids:
watch = datastore.data['watching'].get(uuid)
if watch and watch.history_n >= 2:
sorted_keys = sorted(watch.history.keys(), key=lambda x: int(x))
datastore.set_last_viewed(uuid, int(sorted_keys[-2]))
updated += 1
result_message = gettext("{} watches updated").format(updated)

elif (op == 'mute'):
for uuid in uuids:
if datastore.data['watching'].get(uuid):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@
<button type="submit" name="op" value="set-fetch-backend" id="op-set-fetch-backend" hidden></button>
<button type="submit" name="op" value="set-proxy" id="op-set-proxy" hidden></button>
<button class="pure-button button-secondary button-xsmall" name="op" value="mark-viewed"><i data-feather="eye" ></i>&nbsp;{{ _('Mark viewed') }}</button>
<button class="pure-button button-secondary button-xsmall" name="op" value="mark-unviewed"><i data-feather="eye-off" ></i>&nbsp;{{ _('Mark unviewed') }}</button>
<button class="pure-button button-secondary button-xsmall" name="op" value="notification-default"><i data-feather="bell" ></i>&nbsp;{{ _('Use default notification') }}</button>
<button class="pure-button button-secondary button-xsmall" name="op" value="clear-errors"><i data-feather="x-circle" ></i>&nbsp;{{ _('Clear errors') }}</button>
<button class="pure-button button-secondary button-xsmall" style="background: #dd4242;" name="op" value="clear-history"
Expand Down
2 changes: 1 addition & 1 deletion changedetectionio/tests/test_element_removal.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def test_element_removal_full(client, live_server, measure_memory_usage, datasto

# There should not be an unviewed change, as changes should be removed
res = client.get(url_for("watchlist.index"))
assert b"unviewed" not in res.data
assert b'has-unread-changes' not in res.data

# Re #2752
def test_element_removal_nth_offset_no_shift(client, live_server, measure_memory_usage, datastore_path):
Expand Down
2 changes: 1 addition & 1 deletion changedetectionio/tests/test_ignorehyperlinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_render_anchor_tag_content_true(client, live_server, measure_memory_usag
# since the link has changed, and we chose to render anchor tag content,
# we should detect a change (new 'has-unread-changes' class)
res = client.get(url_for("watchlist.index"))
assert b"unviewed" in res.data
assert b'has-unread-changes' in res.data
assert b"/test-endpoint" in res.data

# Cleanup everything
Expand Down
61 changes: 61 additions & 0 deletions changedetectionio/tests/test_mark_unviewed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env python3

"""Re #4382 - the watch list "Mark unviewed" bulk operation.
Mark unviewed winds last_viewed back to the second-newest snapshot, so the row is unviewed again
and the [diff] link still opens on the latest change. A watch with only one snapshot has no
change to un-view, so it must be left alone.
"""

from flask import url_for

from .util import set_original_response, set_modified_response, wait_for_all_checks, delete_all_watches, \
extract_UUID_from_client


def test_mark_unviewed(client, live_server, measure_memory_usage, datastore_path):
set_original_response(datastore_path=datastore_path)
datastore = live_server.app.config['DATASTORE']

client.post(
url_for("ui.ui_views.form_quick_watch_add"),
data={"url": url_for('test_endpoint', _external=True), "tags": ''},
follow_redirects=True
)
wait_for_all_checks(client)
uuid = extract_UUID_from_client(client)
watch = datastore.data['watching'][uuid]

# Only one snapshot - nothing to un-view, so the operation must not flag the row
res = client.post(url_for("ui.form_watch_list_checkbox_operations"),
data={"op": "mark-unviewed", "uuids": uuid},
follow_redirects=True)
assert b'0 watches updated' in res.data
assert not watch.has_unviewed
assert b'has-unread-changes' not in res.data

# A real change lands -> unviewed
set_modified_response(datastore_path=datastore_path)
client.post(url_for("ui.form_watch_checknow"), follow_redirects=True)
wait_for_all_checks(client)
assert watch.has_unviewed

res = client.post(url_for("ui.form_watch_list_checkbox_operations"),
data={"op": "mark-viewed", "uuids": uuid},
follow_redirects=True)
assert not watch.has_unviewed
assert b'has-unread-changes' not in res.data

# The actual feature - it comes back as unviewed
res = client.post(url_for("ui.form_watch_list_checkbox_operations"),
data={"op": "mark-unviewed", "uuids": uuid},
follow_redirects=True)
assert b'1 watches updated' in res.data
assert watch.has_unviewed
assert b'has-unread-changes' in res.data

# ...and [diff] still opens on the latest change, not the whole history
sorted_keys = sorted(watch.history.keys(), key=lambda x: int(x))
assert watch.get_from_version_based_on_last_viewed == sorted_keys[-2]

delete_all_watches(client)
4 changes: 4 additions & 0 deletions changedetectionio/translations/cs/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2792,6 +2792,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "Označit jako shlédnuté"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Použít výchozí oznámení"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/de/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2837,6 +2837,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "Markierung angesehen"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Standardbenachrichtigung verwenden"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/en_GB/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2786,6 +2786,10 @@ msgstr ""
msgid "Mark viewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr ""
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/en_US/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2786,6 +2786,10 @@ msgstr ""
msgid "Mark viewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr ""
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/es/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2863,6 +2863,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "Marcar visto"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Usar notificación predeterminada"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/fr/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2797,6 +2797,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "Marquer consulté"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Utiliser la notification par défaut"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/id/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2895,6 +2895,10 @@ msgstr "Atur proksi untuk yang dipilih"
msgid "Mark viewed"
msgstr "Tandai telah dilihat"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Gunakan notifikasi default"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/it/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2788,6 +2788,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "Segna come visualizzato"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Usa notifica predefinita"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/ja/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2805,6 +2805,10 @@ msgstr "選択項目のプロキシを設定"
msgid "Mark viewed"
msgstr "既読にする"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "デフォルト通知を使用"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/ko/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2796,6 +2796,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "본 것으로 표시"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "기본 알림 사용"
Expand Down
6 changes: 5 additions & 1 deletion changedetectionio/translations/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: changedetection.io 0.60.9\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2026-10-24 21:02+0200\n"
"POT-Creation-Date: 2026-10-26 11:14+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -2785,6 +2785,10 @@ msgstr ""
msgid "Mark viewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr ""
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/pl/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2941,6 +2941,10 @@ msgstr "Ustaw serwer proxy dla zaznaczonych obserwacji"
msgid "Mark viewed"
msgstr "Oznacz jako przeczytane"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Użyj domyślnego powiadomienia"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/pt_BR/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2834,6 +2834,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "Marcar como visualizado"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Usar notificação padrão"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/ru/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2900,6 +2900,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "Отметить просмотренные"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Использовать уведомление по умолчанию"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/tr/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2839,6 +2839,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "Görüldü olarak işaretle"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Varsayılan bildirimi kullan"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/uk/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2818,6 +2818,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "Позначити як переглянуте"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "Вик. сповіщення за замовчуванням"
Expand Down
4 changes: 4 additions & 0 deletions changedetectionio/translations/zh/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2792,6 +2792,10 @@ msgstr ""
msgid "Mark viewed"
msgstr "标记为已读"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "使用默认通知"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2797,6 +2797,10 @@ msgstr "為所選項目設定代理伺服器"
msgid "Mark viewed"
msgstr "標記為已讀"

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Mark unviewed"
msgstr ""

#: changedetectionio/blueprint/watchlist/templates/watch-overview.html
msgid "Use default notification"
msgstr "使用預設通知"
Expand Down
Loading