Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 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
01cb578
Turn the commit page's replies chevron down while they show, as on th…
simonhamp Nov 18, 2026
2f4d5f4
Read an author's replies to themselves as one thread, as the web does
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
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
6 changes: 3 additions & 3 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
13 changes: 13 additions & 0 deletions app/Devnull/Data/Commit.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,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 @@ -76,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 @@ -143,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 @@ -164,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
14 changes: 8 additions & 6 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 Down Expand Up @@ -62,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
39 changes: 39 additions & 0 deletions app/Devnull/Pop.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace App\Devnull;

/**
* How a star or a pastel looks at each step of the pop it gives when tapped,
* after the web's: the star grows to 1.35 tilted 12 degrees and springs back
* (`star-pop`), the pastel grows to 1.25 and settles (its button's
* `animate()`). See Concerns\PopsReactions for the steps.
*/
final class Pop
{
/**
* Drawn as it is, with the animation that the next step uses, so the phone
* has a node to animate from.
*/
public const string Ready = 'ready';

public const string Up = 'up';

public const string Down = 'down';

/**
* The icon's transform at $step, or nulls when it isn't popping.
*
* @return array{scale: float|null, rotate: float|null, duration: int|null, easing: string|null}
*/
public static function transform(?string $step, string $button): array
{
$star = $button === 'star';

return match ($step) {
self::Ready => ['scale' => 1.0, 'rotate' => 0.0, 'duration' => 150, 'easing' => 'ease-out'],
self::Up => ['scale' => $star ? 1.35 : 1.25, 'rotate' => $star ? -12.0 : 0.0, 'duration' => 150, 'easing' => 'ease-out'],
self::Down => ['scale' => 1.0, 'rotate' => 0.0, 'duration' => $star ? 320 : 180, 'easing' => $star ? 'spring' : 'ease-out'],
default => ['scale' => null, 'rotate' => null, 'duration' => null, 'easing' => null],
};
}
}
7 changes: 5 additions & 2 deletions app/Devnull/RowInputs.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ public static function for(Commit $commit, array $scope): array
'stashed' => $scope['stashed'] ?? [],
'unfolded' => $scope['unfolded'] ?? [],
'expandable' => isset($scope['threads']),
'opened' => array_key_exists($commit->id, $scope['threads'] ?? []),
'opened' => array_key_exists($commit->id, $scope['threads'] ?? []) && ! in_array($commit->id, $scope['closingThreads'] ?? [], true),
'faded' => in_array($commit->id, $scope['fadedRows'] ?? [], true),
// A reply whose replies, opened in place, showed its author carried it on gets "Show thread".
'continued' => in_array($commit->id, $scope['threadsContinued'] ?? [], true),
'popping' => [$scope['popping']['star-'.$commit->id] ?? null, $scope['popping']['pastel-'.$commit->id] ?? null],
'tombstones' => $scope['tombstones'] ?? false,
'tombstoneReplies' => array_key_exists($commit->id, $scope['tombstoneReplies'] ?? []),
'shown' => [self::changing($commit), $commit->quotedCommit === null ? null : self::changing($commit->quotedCommit)],
'poll' => [$scope['pollChoices'][$commit->id] ?? null, in_array($commit->id, $scope['voting'] ?? [], true)],
];
Expand Down
176 changes: 176 additions & 0 deletions app/Devnull/SelfThread.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<?php

namespace App\Devnull;

use App\Devnull\Data\Commit;
use Closure;

/**
* A thread its author writes as replies to themselves, read the way the web's
* CommitContinuationQuery reads it: the author's earliest reply to their own
* commit carries it on, then their earliest reply to that one, and so on. A
* deleted reply doesn't carry it on, and nor does a quote, which isn't a reply.
*
* devnull's API doesn't say which reply that is (the web's continuation_id
* isn't in its commits yet), so it's worked out from the replies, oldest
* first, as they come. When devnull does say, its word goes.
*
* On a commit page the parts after the commit follow it on its rail, ten at a
* time as on the web, and each wears its place in the thread ("2/5"). Each
* step down needs the replies of the part above it, so the walk stops where
* they haven't come yet and says whose it's waiting for ($waiting).
*/
final readonly class SelfThread
{
/**
* How many parts a commit page shows at a time, as the web's CommitContinuationQuery::PER_PAGE.
*/
public const int PerPage = 10;

/**
* @param list<Commit> $parts The commits carrying the thread on below the commit, in order, at most the limit.
* @param bool $hasMore Whether another part follows the last of $parts.
* @param bool $hasEnded Whether it's known that no part follows the last of $parts.
* @param string|null $waiting The commit whose replies the walk needs to go on.
*/
public function __construct(
public array $parts = [],
public bool $hasMore = false,
public bool $hasEnded = false,
public ?string $waiting = null,
) {}

/**
* The reply among $replies that carries $commit's thread on, if it's one of them.
*
* @param iterable<Commit> $replies
*/
public static function next(Commit $commit, iterable $replies): ?Commit
{
if ($commit->isDeleted() || $commit->isStaged() || $commit->author->id === '') {
return null;
}

$earliest = null;

foreach ($replies as $reply) {
if ($commit->continuationId !== null) {
if ($reply->id === $commit->continuationId) {
return $reply;
}

continue;
}

if ($reply->parentId !== $commit->id || $reply->isDeleted() || $reply->isStaged() || $reply->author->id !== $commit->author->id) {
continue;
}

if ($earliest === null || self::isEarlier($reply, $earliest)) {
$earliest = $reply;
}
}

return $earliest;
}

/**
* $replies without the one that carries $commit's thread on, which shows as the next part of it instead.
*
* @param list<Commit> $replies
* @return list<Commit>
*/
public static function others(Commit $commit, array $replies): array
{
$next = self::next($commit, $replies);

return $next === null ? $replies : array_values(array_filter($replies, fn (Commit $reply): bool => $reply->id !== $next->id));
}

/**
* Walks down from $commit through the parts that carry its thread on, as far as $limit and the replies that
* have come allow.
*
* @param Closure(Commit): (list<Commit>|null) $repliesOf A commit's first page of replies, or null until it comes.
*/
public static function below(Commit $commit, Closure $repliesOf, int $limit = self::PerPage): self
{
$parts = [];
$above = $commit;

while (true) {
$replies = $repliesOf($above);

if ($replies === null) {
return new self($parts, waiting: $above->id);
}

$next = self::next($above, $replies);

if ($next === null || in_array($next, $parts, true) || $next->id === $commit->id) {
return new self($parts, hasEnded: true);
}

if (count($parts) >= $limit) {
return new self($parts, hasMore: true);
}

$parts[] = $next;
$above = $next;
}
}

/**
* How many of the commits just above $commit, of $ancestors (oldest first), are earlier parts of its thread,
* and whose replies are needed to look further up. Only the author's own commits can be; each one is a part
* when its earliest reply from them is the one below it.
*
* @param list<Commit> $ancestors
* @param Closure(Commit): (list<Commit>|null) $repliesOf
* @return array{0: int, 1: string|null}
*/
public static function above(array $ancestors, Commit $commit, Closure $repliesOf): array
{
$count = 0;
$below = $commit;

foreach (array_reverse($ancestors) as $ancestor) {
if ($below->isDeleted() || $ancestor->isDeleted() || $ancestor->author->id !== $below->author->id || $below->parentId !== $ancestor->id) {
break;
}

$replies = $repliesOf($ancestor);

if ($replies === null) {
return [$count, $ancestor->id];
}

if (self::next($ancestor, $replies)?->id !== $below->id) {
break;
}

$count++;
$below = $ancestor;
}

return [$count, null];
}

/**
* The place in its thread of the commit at $position, as the web's ThreadPositionBadge writes it: "3/7", with
* a "+" when more of the thread follows than has been read. Null for a commit that isn't part of one.
*/
public static function position(int $position, int $size, bool $isOpenEnded): ?string
{
return $size > 1 && $position >= 1 ? $position.'/'.$size.($isOpenEnded ? '+' : '') : null;
}

private static function isEarlier(Commit $reply, Commit $than): bool
{
if ($reply->createdAt === null || $than->createdAt === null || $reply->createdAt->equalTo($than->createdAt)) {
return strcmp($reply->id, $than->id) < 0;
}

return $reply->createdAt->lessThan($than->createdAt);
}
}
Loading
Loading