Skip to content
Merged
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
8 changes: 4 additions & 4 deletions KNOWLEDGE_BASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ Sources: [Starred page](resources/js/pages/starred/index.tsx), [Starred controll

### Pinning a commit

Pin one of your own top-level commits to feature it at the top of your profile's Commits tab. Pinning another replaces the previous pin; unpin to return to the normal list. Replies cannot be pinned, and pinning does not override a commit's visibility or moderation state.
Pin one of your own top-level commits to feature it at the top of your profile's Commits tab. Pinning another replaces the previous pin; unpin to return to the normal list. Replies and guild board posts cannot be pinned, and pinning does not override a commit's visibility or moderation state.

Sources: [pin authorization](app/Http/Requests/UpdateCommitPinRequest.php), [pin action](app/Actions/UpdateCommitPin.php), [profile page](resources/js/pages/user/show.tsx).

Expand Down Expand Up @@ -662,9 +662,9 @@ Guilds are public groups around hashtags and are not generally available yet. In

The Guilds page lists groups by member count. Joining adds matching commits to Following without following every author and clears any existing mute. When a commit appears only because of a joined guild, it says “because you joined” beside the guild label. Leave a guild to reveal its Mute control. Muting hides matching commits from logs and search, including commits by followed authors. You can still open the guild or a commit directly.

Each guild's bulletin board shows commits containing its exact hashtag, newest first, with pagination—not semantic search. Post directly from its composer; the hashtag is added automatically unless already present outside code and links, and is included in the preview. The automatic hashtag and its separator do not use any of your 4,000-character writing allowance, including when scheduling a board post. Hashtags you type yourself still count. Typing a hashtag offers matching guilds in the autocomplete menu; select one with the keyboard or pointer to insert its handle.
Each guild's bulletin board shows commits posted directly to it and regular commits containing its exact hashtag—not semantic search. Matching replies bring their thread onto the board, even when the root has no hashtag. Threads show reply previews and expand like a regular commit log, ordered by root date, newest first. Each page contains 30 distinct root commits; replies do not use up that limit, and Load more adds the next page. Posts from the board's composer stay attached to that guild without an automatic hashtag, including scheduled posts. They count toward the author's commit count but do not appear in their profile log or general feeds. They appear in Following when you join the guild, and in semantic search suggestions and results under a divider with the guild's name and icon. Regular hashtag commits keep appearing on profiles and in feeds as usual. Typing a hashtag offers matching guilds in the autocomplete menu; select one with the keyboard or pointer to insert its handle.

Guild descriptions can be reported privately. When a guild loses its moderator, its page, icon, description, memberships and mute preferences disappear; the original hashtag commits remain. A different person can claim the hashtag, but a removed moderator cannot reclaim it.
Guild descriptions can be reported privately. When a guild has no moderator, including after its moderator deletes their account, it is paused, not deleted. Its page, posts, icon, description, memberships and mute preferences stay connected. New board posts wait until it has a moderator; scheduled board posts stay pending and keep their guild. Ordinary hashtag commits still appear. A different person can claim the hashtag to resume the same guild, but a removed moderator cannot reclaim it.

### Exporting your data

Expand All @@ -687,7 +687,7 @@ Sources: [export settings](resources/js/pages/user-profile/edit.tsx), [export co

### Deleting your account

Settings → Profile → **Delete account** opens a confirmation for permanent deletion of your /dev/null account; an app can also delete it through the signed API. It does not delete your GitHub account. Your top-level commits and every reply under those threads are erased. Your replies are also removed, except that replies from other people beneath them survive under authorless `[deleted]` placeholders. Your devices, the messages and reactions you sent, and all your uploaded images are erased too; other people's messages in your conversations stay with them. Account deletion is not covered by the 30-second commit undo.
Settings → Profile → **Delete account** opens a confirmation for permanent deletion of your /dev/null account; an app can also delete it through the signed API. It does not delete your GitHub account. Your top-level commits and every reply under those threads are erased. Your replies are also removed, except that replies from other people beneath them survive under authorless `[deleted]` placeholders. Your devices, the messages and reactions you sent, and your personal uploaded images are erased too; other people's messages in your conversations stay with them. A guild you moderated is paused and keeps its shared icon and description, memberships and other people's posts. Account deletion is not covered by the 30-second commit undo.

You can sign in with GitHub again later, but start from a new account rather than restoring the deleted one. Export your data first if you want a copy. Deleting from /dev/null cannot retract copies of public content held elsewhere.

Expand Down
11 changes: 9 additions & 2 deletions app/Actions/CreateCommit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use App\Events\CommitsUpdated;
use App\Events\ProfilesUpdated;
use App\Events\UsersUpdated;
use App\Exceptions\GuildPaused;
use App\Jobs\CheckUserLevel;
use App\Jobs\EmbedCommit;
use App\Jobs\LinkCommitTopics;
Expand All @@ -20,6 +21,7 @@
use App\Jobs\ReplyAsTom;
use App\Jobs\UnfurlLink;
use App\Models\Commit;
use App\Models\Guild;
use App\Models\LinkPreview;
use App\Models\Organization;
use App\Models\User;
Expand Down Expand Up @@ -62,15 +64,19 @@ 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, ?Guild $guild = 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, $guild): Commit {
if ($guild instanceof Guild && Guild::query()->whereKey($guild->id)->sharedLock()->firstOrFail()->user_id === null) {
throw new GuildPaused;
}

$linkPreview = $this->linkPreviewFor($url);
$createdAt = now();
$hasGoodReputation = $user->hasGoodReputation();
Expand All @@ -79,6 +85,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,
'guild_id' => $guild?->id,
'body' => $this->emojiShortcodes->replace($body),
'mentions' => [...$replyRecipients, ...$mentions],
'parent_id' => $parent?->id,
Expand Down
5 changes: 3 additions & 2 deletions app/Actions/CreateExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ 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'])
->with('images:id,commit_id')
->select(['id', 'parent_id', 'quoted_commit_id', 'guild_id', 'body', 'status', 'pasteis_count', 'created_at', 'updated_at', 'deleted_at'])
->with(['images:id,commit_id', 'guild'])
->lazyById(500);

$translations = resolve(CommitTranslations::class);
Expand All @@ -236,6 +236,7 @@ private function commits(User $user): Generator
'id' => $commit->id,
'parent_id' => $commit->parent_id,
'quoted_commit_id' => $commit->quoted_commit_id,
'guild_handle' => $commit->guild?->handle,
'body' => $commit->body,
'cached_translations' => $cached[$translations->key($commit)],
'status' => $commit->status->value,
Expand Down
7 changes: 7 additions & 0 deletions app/Actions/CreateGuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ public function handle(User $user, string $handle, string $name, string $descrip
}

$this->membership->handle($user, $guild, true);
} else {
$guild = Guild::query()->whereKey($guild->id)->lockForUpdate()->firstOrFail();

if ($guild->user_id === null) {
$guild->update(['user_id' => $user->id]);
$this->membership->handle($user, $guild, true);
}
}

return $guild;
Expand Down
11 changes: 9 additions & 2 deletions app/Actions/CreateScheduledCommit.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use App\Dto\NewPoll;
use App\Enums\UserUpdate;
use App\Events\UsersUpdated;
use App\Exceptions\GuildPaused;
use App\Models\Guild;
use App\Models\Organization;
use App\Models\ScheduledCommit;
use App\Models\User;
Expand All @@ -29,14 +31,19 @@ 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, ?Guild $guild = 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, $guild): ScheduledCommit {
if ($guild instanceof Guild && Guild::query()->whereKey($guild->id)->sharedLock()->firstOrFail()->user_id === null) {
throw new GuildPaused;
}

$scheduled = ScheduledCommit::query()->create([
'user_id' => $user->id,
'author_id' => $organization?->id,
'guild_id' => $guild?->id,
'body' => $body,
'poll' => $poll instanceof NewPoll ? ['options' => $poll->options, 'duration' => $poll->duration->value] : null,
'images' => $images === [] ? null : $this->createImageFiles->handle($images, $imageDescriptions),
Expand Down
1 change: 1 addition & 0 deletions app/Actions/CreateUserFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
public function handle(User $user): string
{
$commits = $user->commits()
->whereNull('guild_id')
->approved()
->topLevel()
->with('images')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,27 @@
use App\Queries\AdminsQuery;
use Illuminate\Support\Facades\DB;

final readonly class DeleteGuild
final readonly class DeleteGuildModerator
{
public function __construct(private DeleteStoredFiles $files, private AdminsQuery $admins)
public function __construct(private AdminsQuery $admins)
{
//
}

public function handle(Guild $guild): void
{
DB::transaction(function () use ($guild): void {
$moderator = User::query()->whereKey($guild->user_id)->lockForUpdate()->firstOrFail();
$moderator = User::query()->whereKey($guild->user_id)->lockForUpdate()->first();
$guild = Guild::query()->whereKey($guild->id)->lockForUpdate()->firstOrFail();
DB::table('guild_moderator_removals')->insertOrIgnore([
'github_id' => $moderator->github_id, 'handle' => $guild->handle, 'created_at' => now(),
]);
$this->files->retain($guild->icon_path === null ? [] : [$guild->icon_path]);

if ($moderator instanceof User && $guild->user_id === $moderator->id) {
DB::table('guild_moderator_removals')->insertOrIgnore([
'github_id' => $moderator->github_id, 'handle' => $guild->handle, 'created_at' => now(),
]);
$guild->update(['user_id' => null]);
Comment thread
paulinevos marked this conversation as resolved.
Resolved
}

$viewers = DB::table('guild_preferences')->where('guild_id', $guild->id)->pluck('user_id');
$guild->delete();
event(new UsersUpdated($viewers, UserUpdate::Guilds));
event(new UsersUpdated($this->admins->ids(), UserUpdate::Moderation));
event(new UsersUpdated($viewers, UserUpdate::Relationships));
Expand Down
3 changes: 1 addition & 2 deletions app/Actions/DeleteUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public function handle(User $user): void
// Report creation holds shared reporter and commit locks until its attachment paths are saved.
$guilds = Guild::query()->where('user_id', $user->id)->orderBy('id')->lockForUpdate()->get();
$guildMembers = DB::table('guild_preferences')->whereIn('guild_id', $guilds->modelKeys())->whereNot('user_id', $user->id)->pluck('user_id');
$guildIcons = $guilds->flatMap(fn (Guild $guild): array => $guild->icon_path === null ? [] : [$guild->icon_path])->all();
$imagePaths = [...$guildIcons, ...$this->reportImagePaths($user), ...$this->imagePaths($user), ...$this->scheduledImagePaths($user), ...$this->messageImagePaths($user), ...$this->messageVoicePaths($user)];
$imagePaths = [...$this->reportImagePaths($user), ...$this->imagePaths($user), ...$this->scheduledImagePaths($user), ...$this->messageImagePaths($user), ...$this->messageVoicePaths($user)];
resolve(DeleteStoredFiles::class)->retain($imagePaths);

DB::table('commit_topics')->whereIn('commit_id', $this->touchedCommits($user)->select('id'))->delete();
Expand Down
11 changes: 9 additions & 2 deletions app/Actions/UpdateGuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

use App\Enums\UserUpdate;
use App\Events\UsersUpdated;
use App\Exceptions\GuildModeratorRemoved;
use App\Models\Guild;
use App\Models\User;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\DB;

Expand All @@ -17,10 +19,15 @@ public function __construct(private CreateImageFiles $images, private DeleteStor
//
}

public function handle(Guild $guild, string $description, string $emoji, ?UploadedFile $icon, bool $removeIcon): void
public function handle(Guild $guild, User $user, string $description, string $emoji, ?UploadedFile $icon, bool $removeIcon): void
{
DB::transaction(function () use ($guild, $description, $emoji, $icon, $removeIcon): void {
DB::transaction(function () use ($guild, $user, $description, $emoji, $icon, $removeIcon): void {
$guild = Guild::query()->whereKey($guild->id)->lockForUpdate()->firstOrFail();

if ($guild->user_id !== $user->id) {
throw new GuildModeratorRemoved;
}

$path = $guild->icon_path;

if ($icon instanceof UploadedFile || $removeIcon) {
Expand Down
Loading
Loading