-
Notifications
You must be signed in to change notification settings - Fork 387
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
Show custom user tags on beatmapset #11750
base: master
Are you sure you want to change the base?
Show custom user tags on beatmapset #11750
Conversation
…rn description with response?
// TODO: Add option to multi query when beatmapset requests all tags for beatmaps? | ||
return $this->memoize( | ||
__FUNCTION__, | ||
fn () => cache_remember_mutexed( |
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.
mutexed seems not very useful when it's just db access? Like, nothing would work if the db is unhealthy.
const tag = asTagJsonWithCount(maybeTag); | ||
tag.count = tagId.count; | ||
userTags.push(asTagJsonWithCount(tag)); |
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.
can just push { ...maybeTag, count: tagId.count }
(also why is it converting the thing twice)
{tags.map((tag, i) => ( | ||
<React.Fragment key={`${tag}-${i}`}> | ||
{this.tags.map((tag) => ( | ||
<React.Fragment key={`${tag}`}> |
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.
the -${i}
is required to avoid duplicate keys (mainly for mapper tags but also now in conjunction with user tags)
* @property-read User $user | ||
* @property int $user_id | ||
*/ | ||
class BeatmapTag extends Model | ||
{ | ||
protected $primaryKey = ':composite'; | ||
protected $primaryKeys = ['beatmap_id', 'tag_id', 'user_id']; | ||
public $incrementing = false; | ||
|
||
public static function topTagIdsQuery(int $beatmapId, int $limit = 50) |
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.
why is it not a scope
* @property-read User $user | ||
* @property int $user_id | ||
*/ | ||
class BeatmapTag extends Model | ||
{ | ||
protected $primaryKey = ':composite'; | ||
protected $primaryKeys = ['beatmap_id', 'tag_id', 'user_id']; | ||
public $incrementing = false; |
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.
position public before protected?
The intent with this one was to have a full list of tags you can use when adding a tag to a beatmap. If we don't have a way to retrieve this, how are users supposed to add new tags on web/client? |
that'd be |
Oh, right. If the tags are attached to the Beatmap itself then yeah that endpoint is useless. |
Something like this?
This isn't the final display, just something to get going (There was some discussion about show counts and colour coding the tag types as well, differentiating user/mapper tags, etc), those will be separate; I don't think there's anything set up to write tags yet either? 👀
I just combined the mapper and user tags into the same tag it they're the same for now.
The Beatmap top tag cache now only caches the id and count, and the tags are moved into a local singleton cache.
The
api.beatmap.tags.index
endpoint is also removed since that doesn't seem useful when you're probably wanting the tags together with the Beatmap/Beatmapset with the mapper tags as well?I'm also splitting up the search and indexing part into a separate PR after shuffling some things around.