Skip to content

Pin a commit to your profile from its More menu - #39

Merged
simonhamp merged 3 commits into
NativePHP:mainfrom
RaphaelFakhri:feat/pin-commit
Oct 21, 2026
Merged

simonhamp merged 3 commits into
NativePHP:mainfrom
RaphaelFakhri:feat/pin-commit

Conversation

@RaphaelFakhri

@RaphaelFakhri RaphaelFakhri commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Pin a commit to your profile from its More menu
The web lets you pin one of your commits to the top of your profile (dev-null-sh/dev-null.sh#90), and the app already shows a pinned commit there. This adds a way to pin and unpin from the app.

This depends on the dev-null.sh PR that adds PUT and DELETE /api/v1/commits/{id}/pin to the signed API (dev-null-sh/dev-null.sh#829). Until it merges, Pin to profile gets a 404 and shows devnull's error.

Changes

  • Client::pin() and Client::unpin() send a signed, bodiless PUT or DELETE to commits/{id}/pin through react(), as star() does, and read the commit devnull answers with, including is_pinned. A pin or unpin leaves your kept starred commits as they are.
  • More shows Pin to profile, or Unpin from profile on the pinned one, only on your own approved top-level commits, as the web's Pin is only on your own commits.
  • After the call, a toast says "Commit pinned to your profile." or "Commit unpinned.", as on the web. A new pin clears the old one on every commit the screen shows.
  • On your profile, the pinned commit moves to the top straight away and leaves your commits list. Unpinning takes it off the top. The profile and its commits then refresh, as the web reloads them after a pin.

Tests

  • ClientTest: pin and unpin send a signed, bodiless PUT/DELETE to /api/v1/commits/c1/pin and read is_pinned.
  • ClientCacheTest: pinning or unpinning a starred commit keeps your kept starred commits in their order.
  • CommitMenuTest: More holds Pin to profile on your own published commit and not on a pending one; pinning from your profile puts the commit on top and changes the item to Unpin from profile; unpinning puts it back in the list; replies and other users' commits get no Pin item, and togglePin sends nothing for them.

php artisan test tests/Feature/Screens/CommitMenuTest.php tests/Feature/Devnull/ClientTest.php tests/Feature/Screens/LogTest.php: 7 failed without the change, 110 passed with it. LogTest's check that More leaves out bookmarks now expects the Pin item on your own commit. Pint is clean.

@simonhamp

Copy link
Copy Markdown
Member

thanks! can you fix the conflicts?

# Conflicts:
#	app/Devnull/Client.php
#	app/Devnull/CommitMenu.php
#	app/Devnull/Data/Commit.php
#	app/NativeComponents/Concerns/ShowsCommits.php
#	tests/Feature/Screens/CommitMenuTest.php
@RaphaelFakhri

Copy link
Copy Markdown
Contributor Author

@simonhamp Done. The branch now merges the latest main, and the conflicts are resolved:

  • Save commit is gone from More, as main replaced bookmarks with stars, so More holds Share link, then Pin to profile on your own published commit.
  • LogTest's new check that More leaves out bookmarks now expects the Pin item on your own commit.
  • react() updates your kept starred commits only for a star or unstar, so pinning a starred commit no longer moves it to the top of Starred. ClientCacheTest covers this.

The full suite passes except AppIconTest, which needs the GD extension that the test container lacks. Pint is clean.

@simonhamp
simonhamp merged commit 6b615be into NativePHP:main Oct 21, 2026
1 check 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