display creation date of artist bookmarks

This commit is contained in:
Spine
2024-11-16 06:43:17 +00:00
parent 5396402c31
commit d8f48c9187
2 changed files with 34 additions and 23 deletions

View File

@@ -244,15 +244,17 @@ class Bookmark extends \Gazelle\BaseUser {
public function artistList(): array {
self::$db->prepared_query("
SELECT ag.ArtistID, aa.Name
FROM bookmarks_artists AS ba
INNER JOIN artists_group AS ag USING (ArtistID)
SELECT ag.ArtistID AS artist_id,
aa.Name AS artist_name,
ba.Time AS created
FROM bookmarks_artists ba
INNER JOIN artists_group ag USING (ArtistID)
INNER JOIN artists_alias aa ON (ag.PrimaryAlias = aa.AliasID)
WHERE ba.UserID = ?
ORDER BY aa.Name
", $this->user->id()
);
return self::$db->to_pair('ArtistID', 'Name', false);
return self::$db->to_array(false, MYSQLI_ASSOC, false);
}
/**

View File

@@ -1,7 +1,7 @@
{{ header(user.username ~ ' Bookmarked artists', {'js': 'browse'}) }}
<div class="thin">
<div class="header">
<h2>{{ user.username }} Bookmarked artists</h2>
<h2>{{ user.id|user_url }} Bookmarked artists</h2>
<div class="linkbox">
<a href="bookmarks.php?type=torrents" class="brackets">Torrents</a>
<a href="bookmarks.php?type=artists" class="brackets">Artists</a>
@@ -11,33 +11,42 @@
</div>
<div class="pad">
{% set own_profile = user.id == viewer.id %}
{% for id, name in list %}
{% if loop.first %}
{% for item in list %}
{% if loop.first %}
<table class="artist_table">
<tr class="colhead">
<td>Artist</td>
<td width="15%">Created</td>
<td width="{{
max(5,
(viewer.permitted('site_torrents_notify') ? 15 : 0)
+ (own_profile ? 15 : 0)
)
}}%">Action</td>
</tr>
{% endif %}
{% endif %}
<tr class="row{{ cycle(['a', 'b'], loop.index0) }} bookmark_{{ id }}">
<td>
<a href="artist.php?id={{ id }}">{{ name }}</a>
<span style="float: right;">
{% if viewer.permitted('site_torrents_notify') %}
{% if not viewer.hasArtistNotification(name) %}
<a href="artist.php?action=notify&amp;artistid={{ id }}&amp;auth={{ viewer.auth }}" class="brackets">Notify of new uploads</a>
{% else %}
<a href="artist.php?action=notifyremove&amp;artistid={{ id }}&amp;auth={{ viewer.auth }}" class="brackets">Do not notify of new uploads</a>
{% endif %}
{% endif %}
{% if own_profile %}
<a href="#" id="bookmarklink_artist_{{ id }}" onclick="Unbookmark('artist', {{ id }}, 'Bookmark'); return false;" class="brackets">Remove bookmark</a>
{% endif %}
</span>
<a href="artist.php?id={{ item.artist_id }}">{{ item.artist_name }}</a>
</td>
<td>{{ item.created|time_diff }}
<td>
{% if own_profile %}
<a href="#" id="bookmarklink_artist_{{ item.artist_id }}" onclick="Unbookmark('artist', {{ item.artist_id }}, 'Bookmark'); return false;" class="brackets">Remove bookmark</a>
{% endif %}
{% if viewer.permitted('site_torrents_notify') %}
{% if not viewer.hasArtistNotification(item.artist_name) %}
<a href="artist.php?action=notify&amp;artistid={{ item.artist_id }}&amp;auth={{ viewer.auth }}" class="brackets">Notify of new uploads</a>
{% else %}
<a href="artist.php?action=notifyremove&amp;artistid={{ item.artist_id }}&amp;auth={{ viewer.auth }}" class="brackets">Do not notify of new uploads</a>
{% endif %}
{% endif %}
</td>
</tr>
{% if loop.last %}
{% if loop.last %}
</table>
{% endif %}
{% endif %}
{% else %}
<h2>No bookmarked artists</h2>
{% endfor %}