feat(signage): reviews typed in by hand and their widget; Add a widget at the top of the widgets, the list in layers (new widgets on top)
Reviews (name, stars, text, date, where) under Signage -> Message & settings, shown one at a time by the reviews widget (a minimum of stars, seconds each); not pulled from Google (owner's choice). The widgets section: one "Add a widget" menu at its top instead of a button per kind; the cards are layers, the top one drawn over the others, so a new widget goes on top; the arrows bring forward / send backward. Plan 6R.19, F-113. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -84,3 +84,18 @@ def test_new_widgets_are_typed(client, owner_h):
|
||||
bad = client.post(f"/api/signage/playlists/{p['id']}/slides", headers=owner_h,
|
||||
json={"kind": "blank", "content": {"widgets": [{"kind": "contact", "contact_fields": ["fax"]}]}})
|
||||
assert err(bad) == "signage.content_invalid"
|
||||
|
||||
|
||||
def test_reviews_typed_in_by_hand(client, owner_h, screens, sent):
|
||||
body = {"reviews": [{"name": " Maria K. ", "stars": 5, "text": "Best octopus on the island", "date": "2026-11-01", "source": "Google"},
|
||||
{"name": "John", "stars": 3, "text": "OK"}]}
|
||||
sent.clear()
|
||||
r = client.put("/api/signage/reviews", headers=owner_h, json=body)
|
||||
assert r.status_code == 200, r.text
|
||||
got = r.json()["reviews"]
|
||||
assert got[0]["name"] == "Maria K." and got[0]["text"] == "Best octopus on the island" and got[1]["date"] is None
|
||||
assert ("signage.changed", sorted([screens[1]["id"], screens[2]["id"]])) in sent
|
||||
assert client.get("/api/signage/screen", headers=screens[1]["h"]).json()["venue"]["reviews"][0]["stars"] == 5
|
||||
assert client.get("/api/signage/reviews", headers=owner_h).json()["reviews"][1]["name"] == "John"
|
||||
assert client.put("/api/signage/reviews", headers=owner_h, json={"reviews": [{"name": "x", "stars": 6, "text": "y"}]}).status_code == 422
|
||||
assert client.put("/api/signage/reviews", headers=owner_h, json={"reviews": [{"name": "x", "stars": 5, "text": ""}]}).status_code == 422
|
||||
|
||||
Reference in New Issue
Block a user