Repository navigation
feat: @organization mentions #1262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ace1851
feat: link @organization mentions to their page
mnapoli 241f93f
fix: look organizations up again once the GitHub rate limit resets
mnapoli 09a25bf
fix: read the GitHub pause from any cache store
mnapoli 4cb9b8e
feat: link the commits written before organizations existed, with com…
mnapoli e8b92d3
fix: stop the organization backfill when GitHub refuses requests
mnapoli 3514d10
refactor: delete commit topics in the actions instead of cascading
mnapoli 2e0eada
fix: keep waiting for the GitHub rate limit instead of failing after …
mnapoli 563df52
refactor: store organization topics as organization rather than profile
mnapoli 4b888b5
fix: link no topic to a commit erased while its organizations were lo…
mnapoli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Actions; | ||
|
|
||
| use App\Enums\TopicType; | ||
| use App\Models\Commit; | ||
| use Illuminate\Support\Facades\DB; | ||
|
|
||
| final readonly class CreateCommitTopics | ||
| { | ||
| /** | ||
| * Links the commit to the organizations it mentions, by the lowercase handle written in its body. A reference the | ||
| * commit is already linked by keeps what it was linked to. A handle of digits only is still a string reference. | ||
| * | ||
| * @param array<string, string> $organizations | ||
| */ | ||
| public function handle(Commit $commit, array $organizations): void | ||
| { | ||
| DB::table('commit_topics')->insertOrIgnore(array_map(fn (int|string $reference, string $id): array => [ | ||
| 'commit_id' => $commit->id, | ||
| 'reference' => (string) $reference, | ||
| 'topic_type' => TopicType::Organization->value, | ||
| 'topic_id' => $id, | ||
| ], array_keys($organizations), $organizations)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Actions; | ||
|
|
||
| use App\Enums\TopicType; | ||
| use App\Models\Profile; | ||
| use Illuminate\Support\Facades\DB; | ||
|
|
||
| final readonly class DeleteOrganization | ||
| { | ||
| /** | ||
| * Deletes an organization GitHub no longer has, and unlinks the commits that mention it, so none links to a page | ||
| * that is gone. | ||
| */ | ||
| public function handle(Profile $organization): void | ||
| { | ||
| DB::transaction(function () use ($organization): void { | ||
| DB::table('commit_topics') | ||
| ->where('topic_type', TopicType::Organization->value) | ||
| ->where('topic_id', $organization->id) | ||
| ->delete(); | ||
|
|
||
| $organization->delete(); | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Serialize new commits with account deletion.
If the user posts a reply in another user's thread after topic cleanup, these locks do not block it.
CreateCommitcan add a topic to that reply, then the reply deletion fails on thecommit_topicsforeign key and rolls back account deletion. Serialize commit creation with account deletion before collecting topics. (raw.githubusercontent.com)Based on learnings: check foreign-key deletion behavior for mutating operations.
Source: Learnings