Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3436948
Hide replies on the Log until asked, and line the rail's end dot up w…
simonhamp Nov 16, 2026
22079e3
Keep a commit's row the same height with its replies open or shut
simonhamp Nov 16, 2026
e082ad5
Post as an organization you're in, as the web does
simonhamp Nov 17, 2026
9941ce0
Merge feat/commit-screen into feat/post-as-org
simonhamp Nov 18, 2026
cbd3bc4
Line the reply bar's Post as avatar up with the field's text
simonhamp Nov 18, 2026
eaeffdc
Treat an organization's commits as yours when you're a member
simonhamp Nov 18, 2026
01cb578
Turn the commit page's replies chevron down while they show, as on th…
simonhamp Nov 18, 2026
be8e9de
Merge feat/commit-screen into feat/post-as-org
simonhamp Nov 18, 2026
c8f904e
Show avatars in the Post as menu
simonhamp Nov 20, 2026
d5cf93d
Even out the reply bar's spacing and lighten its glass
simonhamp Nov 21, 2026
2f4d5f4
Read an author's replies to themselves as one thread, as the web does
simonhamp Nov 21, 2026
4f0ed67
Use glass/80 for both composer bars and even out the Messages bar
simonhamp Nov 21, 2026
c5180c6
Move the glass/N test guard out of Pest.php
simonhamp Nov 21, 2026
083085a
Merge feat/log-threads (#179) into feat/nested-replies
simonhamp Nov 21, 2026
f03090c
Open every level of replies in place on the commit page, as the web does
simonhamp Nov 21, 2026
a0032d3
Move the commit page to a commit in its tree instead of pushing another
simonhamp Nov 21, 2026
10cca47
Animate the commit page's move to another commit in its tree
simonhamp Nov 21, 2026
5c5d26b
Move the commit page's short hash to the top right of the commit
simonhamp Nov 21, 2026
16f3839
Open the replies of the commits above the commit in place
simonhamp Nov 21, 2026
d204792
Fold the replies of the commits above the commit on every move
simonhamp Nov 21, 2026
056deb8
Hold the mention suggestions to six rows and scroll the rest
simonhamp Nov 21, 2026
f9832b5
Let a caller that scrolls the mention list itself turn off its inner …
simonhamp Nov 21, 2026
89bff8d
Count the replies of the commits above from their own pages
simonhamp Nov 22, 2026
f3e4adb
Keep the asked-for ancestor counts with the ancestors
simonhamp Nov 22, 2026
820a175
Suggest every matching org member in Remotes, scrolling past six
simonhamp Nov 22, 2026
b5ecbf7
Tidy a blank line left by the last commit
simonhamp Nov 22, 2026
3b582bb
Scroll to a reply you just sent on a commit page
simonhamp Nov 22, 2026
942a74c
Draw the hairline under replies that another commit follows
simonhamp Nov 22, 2026
52e4541
Open every level of replies in place on the commit page, and move the…
simonhamp Nov 23, 2026
0109aab
Even out the composer bars' spacing and lighten their glass (#194)
simonhamp Nov 23, 2026
c0858d0
Show an author's replies to themselves as one thread, as the web does…
simonhamp Nov 23, 2026
bda3d71
Merge pull request #192 from NativePHP/feat/post-as-avatars
simonhamp Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion app/Devnull/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ final class Account

private const string TermsKey = 'devnull.terms-to-accept';

private const string OrganizationsKey = 'devnull.organizations';

public function user(): ?User
{
$attributes = Cache::get(self::CacheKey);
Expand Down Expand Up @@ -215,7 +217,39 @@ public function rememberTermsToAccept(?string $version): void
}

/**
* Signs this phone out: who it was, the badges, its pastéis and Remotes, your timezone, the terms you owe, every
* The GitHub organizations you can post as, as devnull last said, oldest membership first. None until it has.
*
* @return list<User>
*/
public function organizations(): array
{
$kept = Cache::get(self::OrganizationsKey);

return is_array($kept) ? array_values(array_map(User::fromArray(...), array_filter($kept, is_array(...)))) : [];
}

/**
* Which commits are yours: your own and your organizations' (see Ownership).
*/
public function ownership(): Ownership
{
return Ownership::of($this->user(), $this->organizations());
}

/**
* Remembers the organizations you can post as. With null, from a devnull too old to say, it keeps what it had.
*
* @param list<User>|null $organizations
*/
public function rememberOrganizations(?array $organizations): void
{
if ($organizations !== null) {
Cache::forever(self::OrganizationsKey, array_map(fn (User $organization): array => $organization->toArray(), $organizations));
}
}

/**
* Signs this phone out: who it was, the badges, its pastéis and Remotes, your organizations, your timezone, the terms you owe, every
* answer, image and voice note kept for a quick start, and your unsent drafts and recordings.
*/
public function forget(): void
Expand All @@ -234,5 +268,6 @@ public function forget(): void
Cache::forget(self::PinWarningKey);
Cache::forget(self::TimezoneKey);
Cache::forget(self::TermsKey);
Cache::forget(self::OrganizationsKey);
}
}
32 changes: 18 additions & 14 deletions app/Devnull/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@
public const string IssuesPath = 'issues';

/**
* How many replies the app asks for at a time. devnull sends 50 a page
* unless it's asked for fewer, and the app never asks for more than this.
* How many replies the app asks for at a time, in a feed's thread and on
* a commit's page. devnull sends 50 a page unless it's asked for fewer.
*/
public const int RepliesPerPage = 5;
public const int RepliesPerPage = 10;

/**
* Where the signed-in account's timezone is saved, or unset, with whether their profile shows their local time.
Expand Down Expand Up @@ -301,13 +301,15 @@ public function replies(string $id, ?string $cursor = null): Page
/**
* Commits, as a reply to $parentId or quoting $quotedCommitId, as the web's
* composer, reply box and Quote do. devnull takes one or the other, not both.
* A new commit or a quote may start a poll (see PollDraft::payload()).
* A new commit or a quote may start a poll (see PollDraft::payload()). With
* $author, the handle of an organization you're a member of, it goes out as
* that organization, as the web's Post as picks (see PostAs).
*
* @param array{options: list<string>, duration: int}|null $poll
*/
public function createCommit(string $body, ?string $parentId = null, ?string $quotedCommitId = null, ?array $poll = null): Commit
public function createCommit(string $body, ?string $parentId = null, ?string $quotedCommitId = null, ?array $poll = null, ?string $author = null): Commit
{
$commit = $this->data($this->send('POST', 'commits', payload: self::commitPayload($body, $parentId, $quotedCommitId, poll: $poll)));
$commit = $this->data($this->send('POST', 'commits', payload: self::commitPayload($body, $parentId, $quotedCommitId, $poll, $author)));
$this->cache->commitAdded($commit);

return Commit::fromArray($commit);
Expand All @@ -319,9 +321,9 @@ public function createCommit(string $body, ?string $parentId = null, ?string $qu
*
* @param array{options: list<string>, duration: int}|null $poll
*/
public function signedCommit(string $body, ?string $parentId = null, ?string $quotedCommitId = null, ?array $poll = null): SignedRequest
public function signedCommit(string $body, ?string $parentId = null, ?string $quotedCommitId = null, ?array $poll = null, ?string $author = null): SignedRequest
{
return $this->signedWrite('POST', 'commits', self::commitPayload($body, $parentId, $quotedCommitId, poll: $poll));
return $this->signedWrite('POST', 'commits', self::commitPayload($body, $parentId, $quotedCommitId, $poll, $author));
}

/**
Expand All @@ -331,9 +333,9 @@ public function signedCommit(string $body, ?string $parentId = null, ?string $qu
*
* @param list<DraftImage> $images
*/
public function signedCommitWithImages(string $body, array $images, ?string $parentId = null, ?string $quotedCommitId = null): SignedRequest
public function signedCommitWithImages(string $body, array $images, ?string $parentId = null, ?string $quotedCommitId = null, ?string $author = null): SignedRequest
{
return $this->signedWithImages('commits', self::commitPayload($body, $parentId, $quotedCommitId), $images);
return $this->signedWithImages('commits', self::commitPayload($body, $parentId, $quotedCommitId, author: $author), $images);
}

/**
Expand All @@ -360,14 +362,15 @@ public function signedMessage(string $threadPath, string $body, string $clientId
* Signs a commit to be submitted at $at, as the web's Schedule commit
* does, for the background to send. Only you see it until then. With
* photos it goes as multipart, as a commit with photos does, and a poll
* goes in its JSON.
* goes in its JSON. With $author it goes out as that organization when it's
* due, as long as you're still in it then.
*
* @param list<DraftImage> $images
* @param array<string, mixed>|null $poll
*/
public function signedScheduledCommit(string $body, CarbonInterface $at, array $images = [], ?array $poll = null): SignedRequest
public function signedScheduledCommit(string $body, CarbonInterface $at, array $images = [], ?array $poll = null, ?string $author = null): SignedRequest
{
$payload = array_filter(['body' => $body, 'scheduled_at' => self::scheduleTime($at), 'poll' => $poll], fn (mixed $value): bool => $value !== null);
$payload = array_filter(['body' => $body, 'scheduled_at' => self::scheduleTime($at), 'poll' => $poll, 'author' => $author], fn (mixed $value): bool => $value !== null);

return $images === []
? $this->signedWrite('POST', self::ScheduledCommitsPath, $payload)
Expand Down Expand Up @@ -976,13 +979,14 @@ private function send(string $method, string $path, array $query = [], ?array $p
* @param array{options: list<string>, duration: int}|null $poll
* @return array<string, mixed>
*/
private static function commitPayload(string $body, ?string $parentId, ?string $quotedCommitId, ?array $poll = null): array
private static function commitPayload(string $body, ?string $parentId, ?string $quotedCommitId, ?array $poll = null, ?string $author = null): array
{
return array_filter([
'body' => $body,
'parent_id' => $parentId,
'quoted_commit_id' => $quotedCommitId,
'poll' => $poll,
'author' => $author,
], fn (mixed $value): bool => $value !== null);
}

Expand Down
15 changes: 8 additions & 7 deletions app/Devnull/CommitMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Devnull;

use App\Devnull\Data\Commit;
use App\Devnull\Data\User;
use App\Icons\Lucide;
use Native\Mobile\Edge\Elements\TopBarAction;
use Native\Mobile\Edge\Layouts\Builders\NavAction;
Expand All @@ -13,26 +12,28 @@
* partials/commit-actions): Share link on every commit; Pin to profile or
* Unpin from profile on your own published commit, not a reply; then, after a
* divider, Report commit on someone else's published commit, or Delete commit
* on your own. Each item names the commit, so a tap never rebuilds anything
* from an attribute (see ShowsCommits).
* on yours. An organization's commit is yours while you're a member, whoever
* posted it (see Ownership), so every member gets Delete, as on the web. Only
* a person has a profile to pin to, so it never gets Pin. Each item names the
* commit, so a tap never rebuilds anything from an attribute (see ShowsCommits).
*/
final class CommitMenu
{
/**
* @return list<TopBarAction|NavAction>
*/
public static function items(Commit $commit, ?User $viewer): array
public static function items(Commit $commit, Ownership $ownership): array
{
$isOwn = $viewer !== null && $commit->author->id === $viewer->id;
$isOwn = $ownership->owns($commit);
$items = [];

$items[] = self::item($commit, 'share', 'Share link', Lucide::Link, 'shareCommit');

if ($isOwn && $commit->isApproved() && $commit->parentId === null) {
if ($ownership->isYourOwn($commit) && $commit->isApproved() && $commit->parentId === null) {
$items[] = self::item($commit, 'pin', $commit->isPinned ? 'Unpin from profile' : 'Pin to profile', Lucide::Pin, 'togglePin');
}

if ($viewer !== null && ! $isOwn && $commit->isApproved()) {
if ($ownership->isSignedIn() && ! $isOwn && $commit->isApproved()) {
$items[] = NavAction::divider();
$items[] = self::item($commit, 'report', 'Report commit', Lucide::Flag, 'reportCommit');
} elseif ($isOwn) {
Expand Down
24 changes: 19 additions & 5 deletions app/Devnull/Data/Commit.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Devnull\Display;
use App\Devnull\Lane;
use App\Devnull\Ownership;
use Carbon\CarbonImmutable;
use Closure;
use Throwable;
Expand All @@ -20,6 +21,9 @@
*
* A Nata Nu//ers high score carries its signed run in a fenced block, which
* shows as a card ($scoreCard) instead of as code.
*
* $continuationId is the reply that carries on a thread its author writes as
* replies to themselves, when devnull says which (see SelfThread).
*/
final readonly class Commit
{
Expand Down Expand Up @@ -75,6 +79,7 @@ public function __construct(
public ?ReplyPreview $replyPreview = null,
public int $pasteisCount = 0,
public ?ScoreCard $scoreCard = null,
public ?string $continuationId = null,
) {}

/**
Expand Down Expand Up @@ -142,6 +147,7 @@ public static function fromArray(array $data): self
replyPreview: is_array($data['reply_preview'] ?? null) ? ReplyPreview::fromArray($data['reply_preview']) : null,
pasteisCount: max(0, (int) ($data['pasteis_count'] ?? 0)),
scoreCard: $scoreCard,
continuationId: is_string($data['continuation_id'] ?? null) && $data['continuation_id'] !== '' ? $data['continuation_id'] : null,
);
}

Expand All @@ -163,6 +169,14 @@ public function withMorePasteis(int $change): self
return new self(...[...get_object_vars($this), 'pasteisCount' => max(0, $this->pasteisCount + $change)]);
}

/**
* This commit with the count of replies its own page gives, for a copy that came without one.
*/
public function withRepliesCount(int $repliesCount): self
{
return new self(...[...get_object_vars($this), 'repliesCount' => max(0, $repliesCount)]);
}

public function withPinned(bool $isPinned): self
{
return new self(...[...get_object_vars($this), 'isPinned' => $isPinned]);
Expand Down Expand Up @@ -327,15 +341,15 @@ public function isApproved(): bool
}

/**
* Whether $viewer may vote on the commit's poll, as the web decides it: someone else's published commit, whose
* poll is open and hasn't had their vote yet.
* Whether you may vote on the commit's poll, as the web decides it: a published commit that isn't yours or your
* organization's (see Ownership), whose poll is open and hasn't had your vote yet.
*/
public function canBeVotedOnBy(?User $viewer): bool
public function canBeVotedOnBy(Ownership $ownership): bool
{
return $viewer !== null
return $ownership->isSignedIn()
&& $this->poll !== null
&& $this->isApproved()
&& $this->author->id !== $viewer->id
&& ! $ownership->owns($this)
&& $this->poll->closesAt !== null
&& ! $this->poll->hasVoted
&& ! $this->poll->showsResults()
Expand Down
22 changes: 22 additions & 0 deletions app/Devnull/Data/CurrentUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@
* And the terms: the version in force, which is the moment it took effect, when
* you last accepted them, and whether that was this version. A devnull too old
* to say leaves all three null.
*
* And the GitHub organizations you're a member of, admin or not, oldest
* membership first, which you can post as, as the web's Post as menu lists
* them. A devnull too old to say leaves it null.
*/
final readonly class CurrentUser
{
/**
* @param list<User>|null $organizations
*/
public function __construct(
public User $user,
public int $unreadNotificationsCount = 0,
Expand All @@ -37,6 +44,7 @@ public function __construct(
public ?string $termsVersion = null,
public ?CarbonImmutable $termsAcceptedAt = null,
public ?bool $termsAccepted = null,
public ?array $organizations = null,
) {}

/**
Expand Down Expand Up @@ -69,9 +77,23 @@ public static function fromArray(array $json): self
termsVersion: is_string($data['terms_version'] ?? null) && $data['terms_version'] !== '' ? $data['terms_version'] : null,
termsAcceptedAt: Commit::date($data['terms_accepted_at'] ?? null),
termsAccepted: is_bool($data['terms_accepted'] ?? null) ? $data['terms_accepted'] : null,
organizations: is_array($data['organizations'] ?? null) ? self::organizations($data['organizations']) : null,
);
}

/**
* The organizations you can post as, each drawn as an organization whatever the answer said.
*
* @param array<mixed> $organizations
* @return list<User>
*/
private static function organizations(array $organizations): array
{
$users = array_map(fn (array $organization): User => User::fromArray([...$organization, 'type' => 'organization']), array_values(array_filter($organizations, is_array(...))));

return array_values(array_filter($users, fn (User $organization): bool => $organization->username !== ''));
}

/**
* The version of the terms devnull is waiting for you to accept, exactly as it sent it, or null when you have.
*/
Expand Down
5 changes: 4 additions & 1 deletion app/Devnull/Data/ScheduledCommit.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
* page, which only you see. Until it's submitted it has its body, the options
* of its poll, and how many images it carries. Once submitted, those are its
* commit's, and its status is that commit's: pending review, approved,
* rejected, or deleted.
* rejected, or deleted. $author is the organization it goes out as, or null
* when it goes out as you.
*/
final readonly class ScheduledCommit
{
Expand Down Expand Up @@ -39,6 +40,7 @@ public function __construct(
public CarbonImmutable $scheduledAt,
public ?CarbonImmutable $submittedAt,
public string $status,
public ?User $author = null,
) {}

/**
Expand All @@ -62,6 +64,7 @@ public static function fromArray(array $data): self
scheduledAt: Commit::date($data['scheduled_at'] ?? null) ?? CarbonImmutable::now(),
submittedAt: Commit::date($data['submitted_at'] ?? null),
status: is_string($status) && ($status === 'scheduled' || array_key_exists($status, self::Labels)) ? $status : 'scheduled',
author: is_array($data['author'] ?? null) ? User::fromArray([...$data['author'], 'type' => 'organization']) : null,
);
}

Expand Down
27 changes: 18 additions & 9 deletions app/Devnull/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ final class Display

public const int ReplyBarDescriptionHeight = 100;

/**
* The people to mention above a field (see partials/mention-suggestions): a row's height, and how many rows show
* before the rest scroll inside the list.
*/
public const int MentionRowHeight = 44;

public const int MentionRowsShown = 6;

/**
* A bar holding partials/composer-box with one line of draft, as drawn on an iPhone: the bar's padding, then the
* field over the row of tools and the send button.
Expand All @@ -44,6 +52,12 @@ final class Display
*/
public const int ComposerGlassTint = 40;

/**
* How opaque, in percent, the glass under a composer bar gets on iOS once it has faded in (glass/N, see
* composerBarGlass()). Full glass over a dark screen reads as a heavy slab.
*/
public const int ComposerGlassOpacity = 80;

/**
* About how many characters fit on a line of the box's field, which runs the width of the box.
*/
Expand All @@ -56,12 +70,6 @@ final class Display
*/
public const int HomeIndicatorHeight = 34;

/**
* How far below the top of a reply's row its elbow comes level with the
* middle of the reply's avatar.
*/
public const int ElbowLevel = 22;

/**
* How long ago a commit was made, as the web prints it beside the commit:
* "now", "5m", "3h", "2d", then the date, in the same time zone as dayLabel().
Expand Down Expand Up @@ -300,12 +308,13 @@ public static function fadesInBar(): bool
* The classes for a composer's native:bottom-bar. On iOS that's Liquid Glass: what scrolls under the bar shows
* through it, blurred. A patched mobile-air draws the glass behind the whole bar, under the home indicator too,
* and fades it in over the bar's top ComposerFadeHeight points, so it has no hard top edge. EDGE's own glass on
* an element can't be faded, and stops short of the home indicator. Android has no glass, so the bar stays the
* surface there.
* an element can't be faded, and stops short of the home indicator. The glass stops at ComposerGlassOpacity
* percent (glass/N), so a little of the screen under the bar shows through. Android has no glass, so the bar
* stays the surface there.
*/
public static function composerBarGlass(): string
{
return self::fadesInBar() ? 'glass' : '';
return self::fadesInBar() ? 'glass/'.self::ComposerGlassOpacity : '';
}

/**
Expand Down
Loading
Loading