stashapp / stash

An organizer for your porn, written in Go. Documentation: https://docs.stashapp.cc
https://stashapp.cc/
GNU Affero General Public License v3.0
8.84k stars 781 forks source link

[Feature] Favourite Tags #4617

Open SpedNSFW opened 6 months ago

SpedNSFW commented 6 months ago

A feature I'd love to see is the ability to favourite tags. On the tags page, this would behave the same as it does for performers with a boolean filter option to select only favourites or exclude them.

For items that can be tagged (scenes, performers, etc.), the tag filter should continue to be sorted alphabetically but with the favourited tags on top.

For example, if I had tags: A, B, C, D, E, and F. Normally the tag filter would order them as such, however, if I had favourited the C and E tags, the order would now be C, E, A, B, D, F. Alternatively, the favourited tags could appear in the list twice; at the top and then again in their normal position, so using the previous example: C, E, A, B, C, D, E, F.

This would allow for a step between default behaviour and saved filters, allowing for easier mix-and-matching of a user's favourite tags.

echo6ix commented 6 months ago

Related to #3313

elkorol commented 6 months ago

You can do half of that right now. Just not in the tag select areas

Just create a tag called Favourites and any favourite tag add this tag as a parent tag

Then on the tags page just to see your favourites make a saved filter for Parent Tags > Include All > Favourites. To see the top level of Favourites. If they are nested subtags of the tags that have favorites as a parent. Use the option "Include sub tags)

And filter for that in any other place you can too

elkorol commented 6 months ago

But agree a boolean filter would be nice

SpedNSFW commented 6 months ago

You can do half of that right now. Just not in the tag select areas

Just create a tag called Favourites and any favourite tag add this tag as a parent tag

Then on the tags page just to see your favourites make a saved filter for Parent Tags > Include All > Favourites. To see the top level of Favourites. If they are nested subtags of the tags that have favorites as a parent. Use the option "Include sub tags)

And filter for that in any other place you can too

I don't want all favourite tags at the same time, so that's not really valid. If you do want all your favourite tags added, then that would work, but it's not what I'm suggesting.

Dankonite commented 5 months ago

Coming soon, I got the db working for it and the grid card favorite button added, just need to figure out the filter.

image
SpedNSFW commented 5 months ago

Coming soon, I got the db working for it and the grid card favorite button added, just need to figure out the filter.

The filter should be pretty easy, although I haven't looked at the code in quite a while so take that with a grain of salt. Theoretically, though, it should be something like this:

tagsReordered = [...tags.filter(tag => tag.favourite), ...tags.filter(tag => !tag.favourite)]

And then just use the new variable instead of the existing tags variable. Again, I haven't looked at the code in quite a while so treat that as more pseudocode than anything.

If you mean the Favourite filter for the tags page, you can probably just do a one-for-one copy of the one used for performers.

Anyhow, I appreciate you taking this up.

EDIT: Looks like the code has been changed a lot since I've last seen it. It appears all filters like tags (performers, studios, etc) use the same code. That said, the above pseudocode should still work. model.favourite on a model that doesn't have the favourite property will return falsey. As a side-effect, this would include performers which I don't think is a bad thing.

Dankonite commented 5 months ago

ordering tags favorited -> not seems like something that is too "user preference"", or something that would need to be added as a sort option. But I can see if that isnt too hard to implement. Adding a filter for is/isnt favorited is for sure something that needs to get added

SpedNSFW commented 5 months ago

ordering tags favorited -> not seems like something that is too "user preference"", or something that would need to be added as a sort option. But I can see if that isnt too hard to implement. Adding a filter for is/isnt favorited is for sure something that needs to get added

Ordering tags so that favourites appear first was one of key points in this request. I do agree that it makes sense to have it as a setting, probably opt-in.

Dankonite commented 5 months ago

Ordering tags so that favourites appear first was one of key points in this request.

My mistake, I simply searched for Favorite tags and this came up and I skimmed it. I may be able to add that, but At the very least tag favoriting (the title lol) is coming at the very least. I will try and add it as a sort option, it probably shouldnt be default behaviour but I could see the use for it.