Skip to content

feat: quick visibility toggle on activity cards - #147

Merged
0jonjo merged 2 commits into
mainfrom
feat/activity-visibility-toggle
Aug 15, 2026
Merged

feat: quick visibility toggle on activity cards#147
0jonjo merged 2 commits into
mainfrom
feat/activity-visibility-toggle

Conversation

@0jonjo

@0jonjo 0jonjo commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Motivation

v0.4.2 made activities private by default and gave public ones tokenized URLs. The only way to change an activity's visibility since then is the checkbox buried in the edit form — you have to open the activity, click edit, scroll, tick, save. Managing what is shared became clunky enough that dogfooding turned up the obvious ask: a selector per activity.

What it does

  • Every card in the logged activities list gets a small pill showing its current state — 🌐 Public (emerald) or 🔒 Private (gray), styled after the existing VO2max confidence badge.
  • One click PATCHes toggle_visibility and Turbo replaces just that pill. No page reload, no navigation away from the list.
  • The same partial renders on the activity page actions row, next to Edit/Delete.
  • The card's full-card link_to was narrowed to wrap only the content, with the toggle as a sibling. A <button> nested in an <a> is invalid HTML and Turbo would follow the card link instead of submitting.

Consent

Flipping an activity to public stays an explicit owner action — the action is scoped to current_profile.activities, someone else's activity 404s, and nothing here changes the private-by-default write path or the Strava importer, which keeps importing private. Public athlete pages are untouched.

Tests

524 runs, 1675 assertions, 0 failures, 0 errors. New coverage: toggle flips both directions and answers turbo_stream, HTML falls back to a redirect, another profile's activity 404s, signed-out is bounced, and the index renders the right state per activity. rubocop clean; the four new keys are in all 15 locales.

Private-by-default shipped in v0.4.2 left the edit form as the only way to
change an activity's visibility. Each card in the logged activities list now
carries a Public/Private pill that flips the flag over Turbo without leaving
the page; the same control sits in the activity page actions row.

The card's full-card link_to now wraps only the content, with the toggle as a
sibling — a button nested in an anchor is invalid HTML and Turbo would follow
the link instead of submitting the form.
Copilot AI lite review requested due to automatic review settings August 15, 2026 10:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

toggle! expresses the intent of a boolean flip and skips the photo/gpx
attachment validations, which have nothing to say about visibility and would
500 the toggle on a legacy record carrying an attachment that no longer
validates. It still bumps updated_at.

The button's text is its current state, so a screen reader announced "Private"
with no hint that clicking changes anything — title never becomes the
accessible name when the button has content. aria-label now carries the action.
@0jonjo
0jonjo merged commit 7cb6ff8 into main Aug 15, 2026
5 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.

2 participants