Skip to content

Review of Post suggestions (#115) - #127

Merged
Oceandek merged 1 commit into
mainfrom
feat/review
Nov 12, 2026
Merged

Oceandek merged 1 commit into
mainfrom
feat/review

Conversation

@Oceandek

Copy link
Copy Markdown
Collaborator

Closes #115, part of spec #110 (Social media posts).

What's new

  • Post suggestions screen with Review actions, for any Teacher and the Superuser:
    • "Only my Projects" (where you are the Product Owner) is on by default for Teachers and off for the Superuser, who owns no Projects. API: GET /api/post-suggestions?mine=true.
    • Edit: change the title and caption and pick another medium (a numbered list of the week's photos and video, best first), then Save, which is grey until something changes (R15).
      • The same rules as the AI's answer apply, through the shared post_ai.text_problems: title 1–80 characters, caption at most 1100, the Fixed hashtags plus 1–3 others, at most 2 emoji.
      • The medium must be one of that week's ready photos or its video.
    • Refuse with an optional reason: state refused, meaning no post for that Project that Upload week. The team sees "Not posted on social media this week: …" under its earlier weeks (suggestion_state and refusal_reason on the Weekly update answers).
    • Generate again from waiting, failed or refused: the state goes back to generating, tries and reason are cleared, and one try runs straight away in a background task (suggestions.attempt_now). The page checks again every 5 s while a suggestion is being written.
    • Write it yourself: saving a failed suggestion makes it waiting, with the ranking filled from the week's media.
    • Who reviewed last, and when, is shown ("Deleted user" after deletion).
  • Actions lock the suggestion row. An action that no longer fits the state (e.g. editing a refused suggestion) gives 409 "This suggestion changed meanwhile. Reload the page and try again."
  • Migration 0024: post_suggestions.reviewed_by_id (SET NULL), reviewed_at, refusal_reason.
  • The screen moved to its own review_page.py; social_page.media_grid is shared.

Tests

  • Backend: 432 passed. New test_review.py covers:
    • editing the text and picking another photo;
    • the AI rules for edits (long title, no hashtags, too many emoji);
    • only this week's media;
    • a refusal with its reason reaching the team, and 409 after it;
    • Generate again starting over (a second AI request);
    • writing it yourself after 3 failed tries;
    • "Only my Projects";
    • Students refused (403) and unknown suggestions (404).
  • Frontend: 139 passed. New test_review.py covers:
    • a Teacher editing and saving (with the Save button state);
    • a refusal with a reason through the dialog, which the Student then sees;
    • Generate again with the confirmation, and "Only my Projects" (off for the Superuser, empty when on).
  • Visual check: a screenshot with a suggestion waiting for Review, a refused one and one being written.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Oceandek
Oceandek merged commit 9435134 into main Nov 12, 2026
2 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.

Social media: Review of Post suggestions

1 participant