Forum: asking about one's own chart, forecast or comparison
- "Kérdezek róla a fórumon" on the chart, yearly forecast and comparison pages: after a window that says what goes out, a share link made for the forum (never birth data, names or a title) and a new thread in "Égbolt és képletek" with it attached. - The question shows a card (Sun, Moon, Ascendant with sign, degree and house, the summary's title, a link to the shared page) to logged-in members only; visitors and search engines see only that there is one. The author can take it off, and deleting the question ends the link. - The shared page (/s/...) now shows comparisons (one wheel, the aspects, no names) and yearly forecasts (keys, timeline, transits, the detailed text; without the birthday's place); the backend shares forecasts. - The privacy notice (HU, EN) covers attached charts and muted members. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -99,6 +99,10 @@ pub async fn remove(
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
}
|
||||
// Deleting one's own question takes the shared chart's link down too.
|
||||
if own && let Some(share) = post.share_id {
|
||||
revoke_share(&mut *tx, share, user.id).await?;
|
||||
}
|
||||
let mut reporters = Vec::new();
|
||||
if !own {
|
||||
reporters = super::reports::resolve_for_post(&mut tx, id, user.id).await?;
|
||||
@@ -310,3 +314,34 @@ async fn set_helped(
|
||||
.await?;
|
||||
Ok(Json(posts_json(&state.db, &viewer, std::slice::from_ref(&post)).await?.remove(0)))
|
||||
}
|
||||
|
||||
/// The sharer's link goes (as when revoked on the main site).
|
||||
async fn revoke_share(db: impl sqlx::PgExecutor<'_>, share: uuid::Uuid, owner: uuid::Uuid) -> Result<(), sqlx::Error> {
|
||||
sqlx::query("UPDATE shares SET revoked_at = now() WHERE id = $1 AND owner_id = $2 AND revoked_at IS NULL")
|
||||
.bind(share)
|
||||
.bind(owner)
|
||||
.execute(db)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The author takes the shared chart off their question: the card goes, and
|
||||
/// the link stops working.
|
||||
pub async fn detach_share(
|
||||
State(state): St,
|
||||
viewer: Viewer,
|
||||
WithRejection(Path(id), _): IdPath,
|
||||
) -> ApiResult<StatusCode> {
|
||||
let user = viewer.require_user()?;
|
||||
let (post, _) = load(&state.db, &viewer, id).await?;
|
||||
if post.author_id != Some(user.id) {
|
||||
return Err(ApiError::Forbidden("Csak a saját kérdésedről veheted le a képletet.".into()));
|
||||
}
|
||||
let Some(share) = post.share_id else { return Ok(StatusCode::NO_CONTENT) };
|
||||
let mut tx = state.db.begin().await?;
|
||||
sqlx::query("UPDATE forum.posts SET share_id = NULL WHERE id = $1").bind(id).execute(&mut *tx).await?;
|
||||
revoke_share(&mut *tx, share, user.id).await?;
|
||||
tx.commit().await?;
|
||||
announce(&state, post.thread_id).await;
|
||||
Ok(StatusCode::NO_CONTENT)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user