Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions KNOWLEDGE_BASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ A **commit** is a post on /dev/null, not a Git commit in a repository. Open the

Commits, replies, quotes, scheduling, terminal submissions, and app (signed API) commits share a limit of 10 attempts per minute per user. Posts go through [moderation](#moderation), so a newly submitted commit may be pending rather than public immediately.

Commit cards show where a post was submitted when that source is known: the website, iOS, Android, the lite mobile app, macOS, the terminal, or an app whose platform is unknown. Posting sources reuse the same request classification as daily app-usage metrics: NativePHP is identified by its approved device ID, the Mac app by its user agent, and the lite app by its device ID or web-view user agent. Only recognized NativePHP devices are further distinguished as iOS or Android. The label comes from the posting surface, not a value supplied in the post. Older posts and posts scheduled before source tracking was added may have no label, even when submitted later. New posts from apps without a recognized platform are labeled “via App.” The source is included in the author's data export and cleared if account deletion leaves the post as a tombstone.

Approved top-level commits about specific developments in technology, current affairs or substantive real-world events can receive brief, shared headlines. A headline identifies a particular release, feature, event, change, problem or finding, not a broad category such as "Laravel" or "AI tools". Technical and developer developments carry the most weight. /dev/null community activity also qualifies, including livestreams, Tom, app betas and feature updates. Quote commits include the directly quoted post's text when it is approved and still available, so a brief reaction can share the development of the post it quotes. Replies are not used for headline classification. Casual small talk, broad technology chat without a specific development, and evergreen lifestyle or hobby advice are skipped. OpenAI's Decisions API assesses this text for suitability and checks the closest existing headline names, shortlisted by semantic similarity; when none match, DeepSeek through OpenCode generates a headline from the same text. Posts can be processed together, and newly generated headlines about the same development share the first headline rather than creating duplicates. Different developments involving the same product do not share a headline merely because of that product. No account metadata is sent. A headline expires after fourteen days without a new commit link. This categorization does not change the original post and does not yet add visible headline labels to the interface.

The desktop sidebar shows signed-in members up to five **Hot topics** above **Who to follow**, with bold headlines and a truncated recap underneath when one is available. These aggregate approved top-level commits posted in the past eight hours, with extra weight for trending discussions. A topic needs at least two eligible top-level commits visible to you; replies do not count, and the list can show fewer than five topics or none. Only each author's strongest post contributes to a topic's ranking, so repeated posts from one profile do not lift it. The list respects mutes and blocks. The sidebar no longer repeats your own profile summary; your profile is still available from the main navigation.
Expand Down
6 changes: 4 additions & 2 deletions app/Actions/CreateCommit.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\Dto\NewPoll;
use App\Dto\ThreadEngagement;
use App\Enums\CommitSource;
use App\Enums\CommitStatus;
use App\Enums\CommitUpdate;
use App\Enums\UserUpdate;
Expand Down Expand Up @@ -62,15 +63,15 @@ public function __construct(
* @param array<int, string|null> $imageDescriptions
* @param array<string, string> $replyRecipients
*/
public function handle(User $user, string $body, ?Commit $parent = null, ?Commit $quotedCommit = null, array $images = [], array $imageDescriptions = [], bool|string $linkPreview = true, ?NewPoll $poll = null, array $replyRecipients = [], ?Organization $organization = null): Commit
public function handle(User $user, string $body, ?Commit $parent = null, ?Commit $quotedCommit = null, array $images = [], array $imageDescriptions = [], bool|string $linkPreview = true, ?NewPoll $poll = null, array $replyRecipients = [], ?Organization $organization = null, ?CommitSource $source = null): Commit
{
$url = match ($linkPreview) {
true => $this->urls->first($body),
false => null,
default => $linkPreview,
};

return DB::transaction(function () use ($user, $body, $parent, $quotedCommit, $images, $imageDescriptions, $url, $poll, $replyRecipients, $organization): Commit {
return DB::transaction(function () use ($user, $body, $parent, $quotedCommit, $images, $imageDescriptions, $url, $poll, $replyRecipients, $organization, $source): Commit {
$linkPreview = $this->linkPreviewFor($url);
$createdAt = now();
$hasGoodReputation = $user->hasGoodReputation();
Expand All @@ -79,6 +80,7 @@ public function handle(User $user, string $body, ?Commit $parent = null, ?Commit
$commit = Commit::query()->create([
'user_id' => $user->id,
'author_id' => $organization->id ?? $user->id,
'source' => $source,
'body' => $this->emojiShortcodes->replace($body),
'mentions' => [...$replyRecipients, ...$mentions],
'parent_id' => $parent?->id,
Expand Down
6 changes: 4 additions & 2 deletions app/Actions/CreateExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
public function handle(User $user): array
{
return [
'schema_version' => 8,
'schema_version' => 9,
'exported_at' => now()->toIso8601String(),
'profile' => [
'github_id' => $user->github_id,
Expand Down Expand Up @@ -198,7 +198,7 @@ private function commits(User $user): Generator
{
$commits = $user->commits()
->withTrashed()
->select(['id', 'parent_id', 'quoted_commit_id', 'body', 'status', 'pasteis_count', 'created_at', 'updated_at', 'deleted_at'])
->select(['id', 'parent_id', 'quoted_commit_id', 'body', 'status', 'source', 'pasteis_count', 'created_at', 'updated_at', 'deleted_at'])
->with('images:id,commit_id')
->lazyById(500);

Expand All @@ -215,6 +215,7 @@ private function commits(User $user): Generator
'body' => $commit->body,
'cached_translations' => $cached[$translations->key($commit)],
'status' => $commit->status->value,
'source' => $commit->source?->value,
'pasteis_count' => $commit->pasteis_count,
'images' => $commit->images->map(fn (CommitImage $image): string => $image->url())->all(),
'created_at' => $commit->created_at->toIso8601String(),
Expand Down Expand Up @@ -248,6 +249,7 @@ private function organizationCommits(User $user): Generator
'quoted_commit_id' => $commit->quoted_commit_id,
'body' => $commit->body,
'status' => $commit->status->value,
'source' => $commit->source?->value,
'images' => $commit->images->map(fn (CommitImage $image): string => $image->url())->all(),
'created_at' => $commit->created_at->toIso8601String(),
'deleted_at' => $commit->deleted_at?->toIso8601String(),
Expand Down
6 changes: 4 additions & 2 deletions app/Actions/CreateScheduledCommit.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Actions;

use App\Dto\NewPoll;
use App\Enums\CommitSource;
use App\Enums\UserUpdate;
use App\Events\UsersUpdated;
use App\Models\Organization;
Expand All @@ -29,14 +30,15 @@ public function __construct(private CreateImageFiles $createImageFiles, private
* @param list<UploadedFile> $images
* @param array<int, string|null> $imageDescriptions
*/
public function handle(User $user, string $body, CarbonImmutable $scheduledAt, array $images = [], array $imageDescriptions = [], ?NewPoll $poll = null, bool|string $linkPreview = true, ?Organization $organization = null): ScheduledCommit
public function handle(User $user, string $body, CarbonImmutable $scheduledAt, array $images = [], array $imageDescriptions = [], ?NewPoll $poll = null, bool|string $linkPreview = true, ?Organization $organization = null, ?CommitSource $source = null): ScheduledCommit
{
$body = mb_trim($body);

return DB::transaction(function () use ($user, $organization, $body, $poll, $images, $imageDescriptions, $linkPreview, $scheduledAt): ScheduledCommit {
return DB::transaction(function () use ($user, $organization, $body, $poll, $images, $imageDescriptions, $linkPreview, $scheduledAt, $source): ScheduledCommit {
$scheduled = ScheduledCommit::query()->create([
'user_id' => $user->id,
'author_id' => $organization?->id,
'source' => $source,
'body' => $body,
'poll' => $poll instanceof NewPoll ? ['options' => $poll->options, 'duration' => $poll->duration->value] : null,
'images' => $images === [] ? null : $this->createImageFiles->handle($images, $imageDescriptions),
Expand Down
4 changes: 2 additions & 2 deletions app/Actions/DeleteUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public function handle(User $user): void
}

$user->commits()->delete();
$user->commits()->withTrashed()->update(['user_id' => null, 'author_id' => null, 'body' => '', 'mentions' => null, 'embedding' => null, 'link_preview_id' => null, 'headlines_classified_at' => null]);
$user->commits()->withTrashed()->update(['user_id' => null, 'author_id' => null, 'body' => '', 'mentions' => null, 'embedding' => null, 'link_preview_id' => null, 'headlines_classified_at' => null, 'source' => null]);

// What they posted for organizations is the organizations' own, so it stays, without who posted it.
Commit::query()->withTrashed()->where('user_id', $user->id)->update(['user_id' => null]);
Commit::query()->withTrashed()->where('user_id', $user->id)->update(['user_id' => null, 'source' => null]);

$this->deleteOrgs->handle($this->emptyOrgs($user));

Expand Down
2 changes: 1 addition & 1 deletion app/Actions/UpdateScheduledCommitSubmittedAt.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function handle(string $id, bool $early = false): bool
$scheduled = ScheduledCommit::query()->with(['user', 'author'])->findOrFail($id);
assert(is_string($scheduled->body));
$poll = $scheduled->poll === null ? null : new NewPoll($scheduled->poll['options'], PollDuration::from($scheduled->poll['duration']));
$commit = $this->createCommit->handle($scheduled->user, $scheduled->body, linkPreview: $scheduled->link_preview_url ?? false, poll: $poll, organization: $scheduled->author?->organization);
$commit = $this->createCommit->handle($scheduled->user, $scheduled->body, linkPreview: $scheduled->link_preview_url ?? false, poll: $poll, organization: $scheduled->author?->organization, source: $scheduled->source);
$commit->images()->createMany($scheduled->images ?? []);

$scheduled->forceFill(['commit_id' => $commit->id, 'body' => null, 'poll' => null, 'images' => null, 'link_preview_url' => null])->save();
Expand Down
42 changes: 42 additions & 0 deletions app/Enums/CommitSource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

namespace App\Enums;

use App\Models\Device;
use Illuminate\Http\Request;

/**
* Where a commit was created. It reuses the app classification that also
* counts daily app usage, then distinguishes supported mobile platforms.
*/
enum CommitSource: string
{
case Web = 'web';
case Ios = 'ios';
case Android = 'android';
case LiteMobile = 'lite_mobile';
case Macos = 'macos';
case Cli = 'cli';
case Api = 'api';

/** The request determines the source; a commit payload cannot choose it. */
public static function forRequest(Request $request): self
{
$device = $request->attributes->get(Device::class);
$appId = $device instanceof Device ? $device->app_id : null;

return match (ActiveDayApp::forRequest($request)) {
ActiveDayApp::Web => self::Web,
ActiveDayApp::LiteMobile => self::LiteMobile,
ActiveDayApp::Mac => self::Macos,
ActiveDayApp::Other => self::Api,
ActiveDayApp::NativeMobile => match (explode(':', (string) $appId, 2)[0]) {
'ios' => self::Ios,
'android' => self::Android,
default => self::Api,
},
};
}
}
6 changes: 5 additions & 1 deletion app/Http/Controllers/Api/CommitController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\Actions\CreateCommit;
use App\Actions\DeleteCommit;
use App\Enums\CommitSource;
use App\Http\Requests\CreateApiCommitRequest;
use App\Http\Requests\DeleteApiCommitRequest;
use App\Http\Requests\ShowApiCommitRequest;
Expand Down Expand Up @@ -51,13 +52,16 @@ public function show(ShowApiCommitRequest $request, #[CurrentUser] ?User $curren
*/
public function store(CreateApiCommitRequest $request, #[CurrentUser] User $user, CreateCommit $action, CommitPageQuery $page): JsonResponse
{
$commit = $action->handle($user, $request->string('body')->value(), $request->parent(), $request->quotedCommit(), $request->images(), $request->imageDescriptions(), poll: $request->poll(), replyRecipients: $request->replyRecipients(), organization: $request->organization());
$source = CommitSource::forRequest($request);

$commit = $action->handle($user, $request->string('body')->value(), $request->parent(), $request->quotedCommit(), $request->images(), $request->imageDescriptions(), poll: $request->poll(), replyRecipients: $request->replyRecipients(), organization: $request->organization(), source: $source);

return CommitResource::make($page->get($commit, $user))
->response()
->setStatusCode(201);
}

/** Deletes an API commit and returns an empty success response. */
public function destroy(DeleteApiCommitRequest $request, Commit $commit, DeleteCommit $action): Response
{
$action->handle($commit);
Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/Api/ScheduledCommitController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\Actions\CreateScheduledCommit;
use App\Actions\DeleteScheduledCommit;
use App\Enums\CommitSource;
use App\Http\Requests\CreateApiScheduledCommitRequest;
use App\Http\Requests\DeleteApiScheduledCommitRequest;
use App\Http\Resources\ScheduledCommitResource;
Expand Down Expand Up @@ -33,7 +34,9 @@ public function index(#[CurrentUser] User $user, ScheduledCommitsQuery $schedule
*/
public function store(CreateApiScheduledCommitRequest $request, #[CurrentUser] User $user, CreateScheduledCommit $action): JsonResponse
{
$scheduled = $action->handle($user, $request->string('body')->value(), CarbonImmutable::parse($request->string('scheduled_at')->value())->utc(), $request->images(), $request->imageDescriptions(), $request->poll(), $request->linkPreview(), $request->organization());
$source = CommitSource::forRequest($request);

$scheduled = $action->handle($user, $request->string('body')->value(), CarbonImmutable::parse($request->string('scheduled_at')->value())->utc(), $request->images(), $request->imageDescriptions(), $request->poll(), $request->linkPreview(), $request->organization(), source: $source);

return ScheduledCommitResource::make($scheduled)
->response()
Expand Down
6 changes: 5 additions & 1 deletion app/Http/Controllers/Cli/CommitController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Http\Controllers\Cli;

use App\Actions\CreateCommit;
use App\Enums\CommitSource;
use App\Enums\CommitStatus;
use App\Http\Requests\CreateCliCommitRequest;
use App\Models\User;
Expand All @@ -13,9 +14,12 @@

final readonly class CommitController
{
/**
* Creates a terminal commit and returns its URL, keeping the CLI source separate from signed app posts.
*/
public function store(CreateCliCommitRequest $request, #[CurrentUser] User $user, CreateCommit $action): Response
{
$commit = $action->handle($user, $request->string('body')->value(), $request->parent(), images: $request->images());
$commit = $action->handle($user, $request->string('body')->value(), $request->parent(), images: $request->images(), source: CommitSource::Cli);

$url = route('commit.show', [$user, $commit]);

Expand Down
7 changes: 6 additions & 1 deletion app/Http/Controllers/CommitController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Actions\CreateCommit;
use App\Actions\DeleteCommit;
use App\Dto\ThreadContinuation;
use App\Enums\CommitSource;
use App\Enums\CommitStatus;
use App\Http\Requests\CreateCommitRequest;
use App\Http\Requests\DeleteCommitRequest;
Expand Down Expand Up @@ -63,12 +64,15 @@ public function show(ShowCommitRequest $request, #[CurrentUser] ?User $currentUs
])->withViewData(['preview' => $preview]);
}

/**
* Creates a web commit with its request-derived source, then flashes the commit and any new achievements.
*/
public function store(CreateCommitRequest $request, #[CurrentUser] User $user, CreateCommit $action, UserAchievementsQuery $achievements): RedirectResponse
{
$before = $achievements->unlockedBadgeNames($user);

$organization = $request->organization();
$commit = $action->handle($user, $request->string('body')->value(), quotedCommit: $request->quotedCommit(), images: $request->images(), imageDescriptions: $request->imageDescriptions(), linkPreview: $request->linkPreview(), poll: $request->poll(), organization: $organization);
$commit = $action->handle($user, $request->string('body')->value(), quotedCommit: $request->quotedCommit(), images: $request->images(), imageDescriptions: $request->imageDescriptions(), linkPreview: $request->linkPreview(), poll: $request->poll(), organization: $organization, source: CommitSource::forRequest($request));

$unlocked = $achievements->unlockedBadgeNames($user)->diff($before)->values();

Expand All @@ -92,6 +96,7 @@ public function store(CreateCommitRequest $request, #[CurrentUser] User $user, C
return back();
}

/** Deletes a commit and returns its restoration window to the frontend. */
public function destroy(DeleteCommitRequest $request, Commit $commit, DeleteCommit $action): RedirectResponse
{
$commit = $action->handle($commit);
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/CommitReplyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\Actions\CreateCommit;
use App\Actions\DeleteCommit;
use App\Enums\CommitSource;
use App\Enums\CommitStatus;
use App\Http\Requests\CreateCommitReplyRequest;
use App\Http\Requests\DeleteCommitReplyRequest;
Expand Down Expand Up @@ -40,7 +41,7 @@ public function index(ListCommitRepliesRequest $request, #[CurrentUser] ?User $u
public function store(CreateCommitReplyRequest $request, #[CurrentUser] User $user, Commit $commit, CreateCommit $action, CommitThreadQuery $thread): JsonResponse
{
$organization = $request->organization();
$reply = $action->handle($user, $request->string('body')->value(), $commit, images: $request->images(), imageDescriptions: $request->imageDescriptions(), linkPreview: $request->linkPreview(), replyRecipients: $request->replyRecipients(), organization: $organization);
$reply = $action->handle($user, $request->string('body')->value(), $commit, images: $request->images(), imageDescriptions: $request->imageDescriptions(), linkPreview: $request->linkPreview(), replyRecipients: $request->replyRecipients(), organization: $organization, source: CommitSource::forRequest($request));
$parent = $thread->get($commit, $user);

return response()->json([
Expand All @@ -61,6 +62,7 @@ public function store(CreateCommitReplyRequest $request, #[CurrentUser] User $us
], 201);
}

/** Deletes a reply and returns its updated state to the thread. */
public function destroy(DeleteCommitReplyRequest $request, Commit $commit, Commit $reply, DeleteCommit $action): JsonResponse
{
$reply = $action->handle($reply);
Expand Down
Loading