Feedback in the system: ratings, messages, the recommendation question

- Under the summary, the detailed analyses, the forecast and tarot: "How
  tailored to you did it feel?" (1–5 stars); thumbs under answers. Only
  the owner rates, once (changeable); tags, a comment, and a permission
  to read the text; model and prompt version are kept with it
- /visszajelzes: bug, idea, question, other (the page and the browser go
  with it, 10 a day); the state and the operator's reply show there, a
  dot in the account menu marks a new reply. No e-mail, no Telegram
- One NPS question (0–10) in a bar under the header, after two finished
  contents; closing it counts
- Admin → Visszajelzések: numbers by kind, week, tags, model and prompt,
  buyers and others, NPS; ratings with filters, the text only if allowed;
  messages with state, internal note and reply; a count in the admin menu
- Nothing is public. Deleting an account keeps the stars without a name
  or comment; messages go. Privacy policy (hu, en) updated
- The admin menu no longer shows a vertical scrollbar

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-24 07:01:40 +00:00
co-authored by Claude Opus 5.5
parent 3e4653fdb2
commit 62ae4a438e
34 changed files with 3097 additions and 99 deletions
+15
View File
@@ -39,6 +39,8 @@ pub async fn me(State(state): St, auth: AuthUser) -> ApiResult<Json<Value>> {
.bind(auth.id())
.fetch_one(&mut *conn)
.await?;
let replies = super::feedback::unseen_replies(&mut conn, auth.id()).await?;
let nps_due = super::feedback::nps_due(&mut conn, auth.id()).await?;
Ok(Json(json!({
"user": UserView::from(&auth.user),
"providers": providers.into_iter().map(|(p,)| p).collect::<Vec<_>>(),
@@ -53,6 +55,10 @@ pub async fn me(State(state): St, auth: AuthUser) -> ApiResult<Json<Value>> {
"referral_rewards": { "earned": referrals, "limit": super::shares::REFERRAL_LIMIT },
// The "Számláim" menu shows up with the first invoice.
"invoice_count": invoices,
// Replies to the user's feedback not read yet (the menu marks them).
"feedback_replies_unseen": replies,
// Ask the "would you recommend us?" question now.
"nps_due": nps_due,
})))
}
@@ -226,6 +232,15 @@ pub async fn delete_me(
.bind(auth.id())
.execute(&mut *tx)
.await?;
// Ratings and the recommendation answer stay for the statistics, without
// a name and without what was written (messages go with the account).
// Detached here: deleting the user and its analyses in one statement
// would update a rating through both foreign keys at once.
sqlx::query("UPDATE content_ratings SET user_id = NULL, comment = NULL, may_read = false WHERE user_id = $1")
.bind(auth.id())
.execute(&mut *tx)
.await?;
sqlx::query("UPDATE nps_answers SET comment = NULL WHERE user_id = $1").bind(auth.id()).execute(&mut *tx).await?;
// Gifts stay redeemable, but whom they were for and the message go.
sqlx::query(
"UPDATE gifts SET recipient_name = NULL, recipient_email = NULL, from_name = NULL, message = NULL \