Skip to content

Stop serving archived and unpublished activities #1170

Open

Description

@10done

Account deletion archives a host's activities so they leave the catalog. The API and the activity page still return them, with the description decrypted. draft has the same hole.

Expected

draft and archived activities are visible only to their host. Everyone else gets 404 on the detail page and does not see them in the list.

Evidence

Account deletion archives instead of removing the class (learn/src/worker.py):

        try:
            await env.DB.prepare(
                "UPDATE activities SET status='archived' WHERE host_id=? AND status <> 'archived'"
            ).bind(uid).run()

The list accepts archived, draft, and all with no login check. Only catalog hides them:

    status = (params.get("status") or ["catalog"])[0]
    if status not in {"catalog", "published", "waitlist", "draft", "archived", "all"}:
        status = "catalog"
    # ...
        if status == "catalog":
            clauses.append("COALESCE(a.status,'published') IN ('published','waitlist')")
        elif status != "all":
            clauses.append("a.status=?")
            binds.append(status)

Those rows are returned with the description decrypted:

    for row in rows:
        desc      = await decrypt_aes(row.description or "", enc)
        # ...
        activities.append({
            "id":                row.id,
            "title":             row.title,
            "description":       desc,

Detail lookup is by slug or id only. No status check, then 404 only when the row is missing:

    act = await env.DB.prepare(
        "SELECT a.*,u.name AS host_name_enc,u.id AS host_uid"
        " FROM activities a JOIN users u ON a.host_id=u.id"
        " WHERE a.slug=?"
    ).bind(activity_ref).first()
    # ... same query by id ...
    if not act:
        return err("Activity not found", 404)

The activity page uses the same lookup (_server_activity_detail_payload): missing row returns nothing, any status is rendered.

    if not act:
        return None

So GET /api/activities?status=archived, ?status=draft, ?status=all, and /activity/<slug> still serve a class after it was archived.

Activity

  1. added
    good first issue
    2026-11
    on Nov 2, 2026
  2. gopikrishna-20 commented on Nov 5, 2026

    @gopikrishna-20
    Contributor

    hey is this issue open ,i would like to work on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    2026-11good first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions