Skip to content

Commit

Permalink
Merge pull request #503 from tighten/ajm/talk-revision-fix
Browse files Browse the repository at this point in the history
Load current revision for talk.edit route
  • Loading branch information
mattstauffer authored Jun 7, 2024
2 parents c2b1445 + fa26941 commit 7554268
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Controllers/TalksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function store(SaveTalkRequest $request)
public function edit($id)
{
try {
$talk = auth()->user()->talks()->findOrFail($id);
$talk = auth()->user()->talks()->withCurrentRevision()->findOrFail($id);
} catch (Exception $e) {
Session::flash('error-message', 'Sorry, but that isn\'t a valid URL.');
Log::error($e);
Expand Down
11 changes: 11 additions & 0 deletions tests/Feature/TalkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,15 @@ function archived_talks_can_be_deleted()
$response->assertRedirect('talks');
$this->assertDatabaseMissing('talks', ['id' => $talk->id]);
}

/** @test */
public function editing_a_talk(): void
{
$talk = Talk::factory()->create();

$response = $this->actingAs($talk->author)
->get(route('talks.edit', $talk));

$response->assertSuccessful();
}
}

0 comments on commit 7554268

Please sign in to comment.