Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 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
f6c54e2
Move the commit reply bar onto the Remotes composer box
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
a24c1f9
Merge feat/remote-composer into feat/commit-screen
simonhamp Nov 18, 2026
a5d112c
Reply with photos and a preview from the bar, and drop any time
simonhamp Nov 18, 2026
1c0beee
Merge feat/remote-composer into feat/commit-screen
simonhamp Nov 18, 2026
07e127d
Draw the reply bar's fade in the bar on iOS, as Remotes does
simonhamp Nov 18, 2026
1de5fcb
Merge feat/remote-composer into feat/commit-screen
simonhamp Nov 18, 2026
365568c
Merge feat/remote-composer into feat/commit-screen
simonhamp Nov 18, 2026
a529a87
Put the reply bar on Liquid Glass on iOS, as Remotes does
simonhamp Nov 18, 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
6185699
Draw one line above related commits, not the commit's hairline as well
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
2def9bf
Merge pull request #182 from NativePHP/feat/post-as-org
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);
}
}
34 changes: 34 additions & 0 deletions app/Devnull/Beat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace App\Devnull;

use Native\Mobile\AsyncTask;

/**
* Waits $milliseconds on one of NativePHP's background PHP threads, so a
* screen can draw a frame, then change it once the phone has drawn it.
*
* EDGE animates a node from what it showed to what the next frame says
* (`animate-duration`), but it can't play a sequence or animate a row as it
* comes into a list. A screen draws the first step, and the next one when its
* Beat comes back: replies drawn see-through then faded in, a star scaled up
* then sprung back (see Concerns\ExpandsThreads and Concerns\PopsReactions).
*/
final class Beat extends AsyncTask
{
/**
* How long a frame waits for the next step of an animation, so the phone
* has drawn it first.
*/
public const int Step = 60;

public function handle(int $milliseconds): bool
{
// Tests run tasks inline, where only the order of the steps counts.
if (! app()->runningUnitTests()) {
usleep(max(0, $milliseconds) * 1000);
}

return true;
}
}
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
14 changes: 14 additions & 0 deletions app/Devnull/ComposerMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ public static function items(bool $photosFull, bool $voiceNotesGoAlone, string $
];
}

/**
* What the photo button in the reply bar on a commit's page opens: the photo library, or the camera, as the
* composer sheet's two photo buttons do.
*
* @return list<TopBarAction>
*/
public static function photoItems(): array
{
return [
self::item('reply-pick-photos', 'Choose photos', Lucide::ImagePlus, 'pickPhotos'),
self::item('reply-take-photo', 'Take a photo', Lucide::Camera, 'takePhoto'),
];
}

private static function item(string $ref, string $label, Lucide $icon, string $method, bool $disabled = false): TopBarAction
{
return NavAction::make($ref)
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
Loading
Loading