Skip to content

Post as an organization you're in, as the web does - #182

Draft
simonhamp wants to merge 5 commits into
feat/commit-screenfrom
feat/post-as-org
Draft

simonhamp wants to merge 5 commits into
feat/commit-screenfrom
feat/post-as-org

Conversation

@simonhamp

@simonhamp simonhamp commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Depends on #180, and so on #177. This now branches off feat/commit-screen and should merge after it, so the diff here is only post-as-org.

On dev-null.sh a member of a GitHub organization can post as that organization. The avatar in the composer opens a "Post as" menu with you and your organizations. It's in the new commit composer, the Quote dialog and the reply composer. This brings the same thing to the app.

How the web does it (dev-null-sh/dev-null.sh#1361, #1375, #1377, #1492 and #1568 there):

  • Admins and members alike can post as an org. The choice is sent as author (the org's handle) on a commit, a quote, a reply or a scheduled commit. The server checks membership and refuses with "You can only post as an organization you are a member of."
  • GET /api/v1/me lists your organizations with your role, oldest membership first.
  • Commits come back with author.type = organization, the org's avatar, handle and lane. The org's commits show on its page, and notifications name the org as the actor.

The API already has all of this, so no server change is needed.

What changed

  • The organizations from GET /me are kept on the phone (Account::organizations()) and refreshed whenever /me is.
  • The composer sheet (new commit, quote) shows who the commit goes out as above the field: avatar, name and handle. Tapping it opens a menu of you and your organizations, the current one ticked. People in no organization see nothing, as on the web. An issue draft (/feature, /bug) hides it, since issues always come from you.
  • The reply bar on a commit's page has the same avatar at the start of the row under the field, ahead of the photo button. Reply, the round send button, is filled with the org's lane while replying as it.
  • Commit in the sheet is filled with the org's lane too.
  • The choice rides in the outbox payload, so a staged commit or reply shows the org as its author straight away (square avatar, dashed ring in the org's lane).
  • A scheduled commit goes out as the org too, and the Scheduled list shows "As @handle" like the web.
  • When devnull turns a commit down (left the org, rate limited, offline) the usual toast shows and the draft comes back with the org still picked. A commit sent as an org also asks /me again, so if you've left the org the composer falls back to posting as you, which is what the web does.
  • Tapping an org's name or avatar in Notifications opens the org page instead of a user profile that doesn't exist.

Org-authored commits already drew as the web does before this (square avatar, org lane, tap opens the org page, #150/#152/#159). I checked them on the Log, the commit page, the org page and Notifications.

Fitting onto #180's reply bar

#180 rewrote the reply bar, so I merged feat/commit-screen in (9941ce0) rather than rebasing, and moved the reply side over:

The reply sheet itself is only reachable one way now: a reply written in the sheet before #180 that devnull turned down, through its toast's Edit. Reply on the Log opens the commit page with the bar. That sheet still has Post as, starting as you, or as the org that reply was going out as. If you close it unsent, the bar gets the text and photos back as #180 does, but keeps its own Post as choice.

A later merge of feat/commit-screen (be8e9de) brings in #180's fix for the doubled line above Related commits (6185699). It merged clean and touches nothing post-as does.

Org commits count as yours

On the web any member of an org owns its commits, whoever posted them. The server decides it in Commit::isOwnedBy() and the web in useOwnsCommit(). The app used to count only commits authored by you, so a member got Report on their org's commits and no Delete.

Now App\Devnull\Ownership decides it, from your id and the org ids GET /me last listed (Account::organizations()). Everything that asked "is this mine" asks it instead: CommitMenu, the commit-actions partial, ShowsCommits, OpensCommitSheet, OpensStargazers, CommitDetail::isOwn(), Commit::canBeVotedOnBy() and LastVisit. That covers rows on the Log, profiles, org pages, Search, Starred, the commit page and its replies. Commit rows have no swipe actions. Cached rows are keyed on your org ids too (RowInputs), so they redraw when your membership changes.

Checked against upstream production (00c4fed9):

Action Web and server App before App now
Delete (More, commit page nav bar, replies) Any member: DeleteApiCommitRequest uses isOwnedBy, the web uses useOwnsCommit Only commits authored by you Yours and your orgs'
Restore Any member (CreateApiCommitRestorationRequest), through the web's 30 second Undo The app has no undo at all Unchanged
Star Not on an owned commit (CreateApiCommitStarRequest). The web shows the count instead Star button on org commits, which devnull refused The count, as on your own
Who starred The web lists it to any member (ListCommitStarsRequest uses isOwnedBy). The API only answers the member who posted it (ListApiCommitStarsRequest checks user_id) Not reachable on org commits The count opens the sheet. The poster gets the list, other members get "Only the member who posted this commit can see who starred it here."
Pastel Never on an org commit, for anyone: the server answers 404 and the web hides the button, since the pastel would go to whoever posted it Shown, and a tap failed Hidden on org commits for everyone
Report Not on an owned commit (CreateApiCommitReportRequest, the web's useCanReport) Offered on your orgs' commits Not offered
Pin Only your own top-level commit (author_id must be you), and the web only offers it on your profile Person only Unchanged. Orgs have no profile to pin to
Quote a commit waiting for approval Any member (VisibleCommit, the web's quote button) Only your own Yours and your orgs'
Vote on a poll Not on an owned commit (OpenPoll, the web's CommitPoll) Members could vote and devnull refused Results only
Last visit marker Skips owned commits (useLastVisit) Skipped only your own Skips your orgs' too

Membership only refreshes when /me does. If you've left an org elsewhere and try to delete one of its commits, devnull's message shows ("This action is unauthorized.") and the app asks /me again, so the commit goes back to a star and Report.

The response cache also stops counting org commits as yours: posting as an org no longer adds the commit to your own profile list and count, and deleting one doesn't lower your count.

Left as they were:

  • The app has no undo after a delete. The web has a 30 second one. I've logged it as a follow-up.
  • The app offers Pin from any list, the web only on your profile. Same as before this PR.
  • The new commits pill counts every newer commit on the page, yours included. The web and the server's count leave owned ones out. That's not decided by ownership in the app, so I left it.
  • The API only lists who starred an org commit to the member who posted it. Making ListApiCommitStarsRequest use isOwnedBy, as the web's request does, would let every member see it.

Things to know

  • iOS menus can't show images, so the menu lists names and handles with an icon (tick, building, person) rather than avatars. The avatar on the composer is what shows who you're posting as.
  • On Android, a commit turned down instantly (offline, or the membership error) shows the toast but the sheet doesn't come back up. That happens on main as well, with commits as yourself, so it's not from this PR. It looks like mobile-ui's Android bottom sheet not reopening when PHP shows it again straight after hiding it.
  • Two things I hit only through hot reload while testing: once on iOS the app aborted in a PHP worker thread when a view was swapped with the composer sheet up, and on Android a reloaded commit page showed "Call to undefined method CommitDetail::fillIn()" from DrawsSkeletonFirst. Neither came back after a restart.

Testing

  • OrganizationCommitsTest (9 tests) covers ownership: a member gets Delete and can delete an org commit someone else posted, and can't star, give a pastel to, report, pin or vote on it. An outsider gets the star and Report and never Delete. A member can quote a pending org commit. A refused delete shows devnull's message and asks /me again. It also checks the stars sheet's poster-only line and that your profile count stays put.
  • PostAsTest has 13 tests and NotificationsTest one more. The bar tests now check the avatar leads reply-actions, the send circle takes the org's lane and goes back to yours, and a reply with a photo sends author in its multipart JSON. Full suite: 1,943 passed, run serially, after the be8e9de merge.
  • After the merge: iOS 27.0 sim (iPhone 18 Pro, with the mobile-air soft glass patch Commit screen: photos and preview in the reply bar, drop any time, related commits folded #180 needs) and Android 35 emulator, against a local dev-null.sh at upstream production (7513965a), light and dark. Test user is an admin of one org and a member of another, and not in a third. On both I posted as myself and as an org from the composer, quoted as an org, replied as an org from the new bar with a photo, and checked the result on the reply's page, the Log and the org page.
  • Before the merge, on the same setup: staged org commits, Notifications, losing membership, and offline. None of that code changed in the merge.
  • Scheduling as an org is covered by tests only.
  • Org ownership, on a fresh PostAs iPhone 18 Pro sim (iOS 27.0) and the PostAs Android 35 emulator against the same local dev-null.sh. Another member of dev-null-sh posted a commit, and the test user (an admin there) deleted it from Latest on both. On iOS the stars sheet showed the poster-only line for it. I then removed the test user from nativephp on the server only and deleted one of its commits: the error showed, the commit stayed, and after /me it showed a star and Report. A commit from laravel, which the test user isn't in, kept its star and Report on both.

Screenshots

New: org-commit and org-commit-menu (another member's org commit on Latest, before and after), org-stargazers and left-org-delete (iOS only). The rest are from before.

commit-page

iOS light iOS dark Android light Android dark
After

composer

iOS light iOS dark Android light Android dark
Before
After

composer-menu

iOS light iOS dark Android light Android dark
After

left-org-delete

iOS light iOS dark Android light Android dark
After

left-org

iOS light iOS dark Android light Android dark
After

log

iOS light iOS dark Android light Android dark
After

notifications

iOS light iOS dark Android light Android dark
After

offline

iOS light iOS dark Android light Android dark
After

org-commit

iOS light iOS dark Android light Android dark
Before
After

org-commit-menu

iOS light iOS dark Android light Android dark
Before
After

org-page

iOS light iOS dark Android light Android dark
After

org-stargazers

iOS light iOS dark Android light Android dark
After

quote

iOS light iOS dark Android light Android dark
After

reply-bar

iOS light iOS dark Android light Android dark
Before
After

reply-bar-menu

iOS light iOS dark Android light Android dark
After

reply-bar-org

iOS light iOS dark Android light Android dark
After

staged

iOS light iOS dark Android light Android dark
After

Other files: web-composer-menu-dark.png, web-composer-menu-light.png, web-log-light.png, web-org-page-dark.png, web-org-page-light.png

  • No visible change

🤖 Generated with Claude Code

The web lets a member of a GitHub organization post a commit, a quote or a
reply as that organization. The app now does too.

- GET /me's organizations are kept on the phone (Account), and refreshed
  whenever /me is.
- The composer sheet shows who the commit goes out as above the field. A tap
  opens a menu of you and your organizations. The reply bar on a commit's
  page has the same avatar at its start, and hands its choice to the reply
  sheet and back.
- The choice goes to devnull as `author`, which the API already takes, and
  rides in the outbox, so a staged commit shows the organization as its
  author. Commit and Reply use the organization's lane.
- A scheduled commit goes out as the organization too, and the Scheduled
  list says "As @handle" as the web's does.
- If devnull turns a commit down (you left the organization, or it's rate
  limited), the usual toast says why and the draft comes back with the
  organization still picked. The app asks /me again, and a composer whose
  organization is gone posts as you.
- Tapping an organization in Notifications opens its page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Puts post-as-org on top of #180's reply bar. The Post as avatar now
leads the row under the field through composer-box's lead slot, ahead
of the photo button. The round send button takes a colour, so Reply is
filled with the org's lane while replying as it.

The bar no longer opens the reply sheet, so the code that handed the
bar's choice to the sheet and back is gone. A reply sheet reopened for
an old sheet reply that devnull turned down still has Post as, starting
as you or as the org that reply was going out as.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonhamp
simonhamp changed the base branch from main to feat/commit-screen November 18, 2026 02:38
simonhamp and others added 2 commits November 18, 2026 03:17
The avatar led the row at the row's own inset, 12pt left of the text
above it, where the photo button's icon used to line up. post-as takes
an inset now, padded inside its tap target, and the bar passes pl-3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the web any member of an organization owns its commits, whoever posted
them (Commit::isOwnedBy on the server, useOwnsCommit on the web). The app
only counted commits authored by you. Now one Ownership class decides it,
from your id and the organizations GET /me last listed, and everything that
asked "is this mine" asks it instead.

For a member, an organization's commit now offers Delete (in More and in
the commit page's nav bar), shows its star count instead of a star, can be
quoted while pending, and can't be reported or have its poll voted on.
Someone outside the org still gets the star and Report and never Delete.

Pin stays person-only, as on the server and the web. No one gets a pastel
on an organization's commit, matching the web, which hides it because it
would go to whoever posted it.

The API only lists who starred an organization's commit to the member who
posted it, though the web shows it to every member. The stars sheet now
says so on a 404 instead of offering Try again.

If devnull refuses a delete because you've left the org, its message shows
and the app asks /me again, so the commit stops offering Delete. Rows are
cached against your organizations too, so they redraw when that changes.

Deleting or posting an organization's commit no longer changes your own
profile's kept commit count or list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant