Skip to content

Commit

Permalink
add a URL for all events in a year with a specific tag
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpk committed Apr 29, 2022
1 parent 3fa2e23 commit 13df7e6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,27 @@ public function tag($tag) {
]);
}

public function year_tag($year, $tag) {
$tag = Tag::normalize($tag);

$events = $this->events_query($year);

$events = $events->whereHas('tags', function($query) use ($tag){
$query->where('tag', $tag);
});

$event_ids = $events->pluck('id');
$events = $events->get();

return $this->show_events_from_query($events, [
'year' => $year,
'month' => false,
'day' => false,
'home' => (!$year && !$month && !$day),
'page_title' => $year . ' #' . $tag
]);
}

public function tag_archive($tag) {
$tag = Tag::normalize($tag);

Expand Down
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
Route::get('/{year}/{month}', 'Controller@index')->name('month');
Route::get('/{year}', 'Controller@index')->name('year');

Route::get('/{year}/{tag}', 'Controller@year_tag');

Route::get('/{year}/{month}/{partial_slug}', 'Controller@find_matching_events');

Route::get('/event/{key}.json', 'Controller@event_json')->name('event-json');
Expand Down

4 comments on commit 13df7e6

@aminvakil
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty useful, thanks!

Are you going to sign your commits with GPG from now on? As you have just signed two commits and last three commits are marked as unverified :)

@aaronpk
Copy link
Owner Author

@aaronpk aaronpk commented on 13df7e6 May 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched to signing with my ssh key, but apparently GitHub doesn't recognize that yet. And the previously signed ones were actually github signing it with their own key, which seems kind of silly.

@aminvakil
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for clarification.
Of course you know that this can be disabled from https://github.com/settings/keys (Flag unsigned commits as unverified), (it's disabled by default, so for sure you know :)

Not that disabling it will give any extra security or whatsoever, but enabling it when it shows signed commits as "Unverified", will probably raises concerns for someones like me 😉

@aaronpk
Copy link
Owner Author

@aaronpk aaronpk commented on 13df7e6 May 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That setting is unchecked already, but I think what's happening is github sees that there is a signature, but doesn't know how to read ssh key signatures, so it's marking it "unverified" anyway.

Please sign in to comment.