mastodon / mastodon

Your self-hosted, globally interconnected microblogging community
https://joinmastodon.org
GNU Affero General Public License v3.0
47.06k stars 6.96k forks source link

Tags or Annotation for Bookmarked Statuses #28409

Open mariotaku opened 10 months ago

mariotaku commented 10 months ago

Pitch

  1. Allowing annotations or tags of a bookmarked status. 1.1. If tags are allowed: tags like #recipe, #readlater can be attached and displayed below content of original status 1.2. If annotations are allowed: a short piece of text can be attached and displayed below content of original status
  2. Allowing filtering bookmarked statuses by tags or text contained by annotation attached.

Motivation

Bookmarks are displayed in reverse order of them being added. If one have a huge amount of bookmarks (e.g. recipes, life hacks or read later), it would be harder to find desired bookmarks. By adding tags or annotations, and allowing search of bookmarks with annotated content, finding bookmarks will be easier.

maitri-7 commented 10 months ago

Hi. Would like to work on this issue

mariotaku commented 10 months ago

@maitri-7 So great to hear that! I was also thinking about this. Although I have no experience developing ruby on rails app, I did look at the code and thought about the API design.

  1. Add migration to bookmarks schema to add annotation (tags field)
  2. Accept the annotation parameter in the controller for bookmark creation
  3. Add a new route for modifying annotation of a bookmark
  4. Make list bookmark feature capable of search by annotation

What do you think? Please let me know if there's anything I can help with.

shaedrich commented 6 months ago

This is similar to how Telegram handles saved messages: https://telegram.org/blog/new-saved-messages-and-9-more/de?setln=en#tags-for-saved-messages

It would be nice to have these hashtags then in the sidebar where currently the lists are displayed, so that the hashtags can be filtered:

https://mastodon.online/bookmarks/tags/recipe

donaldwilson8 commented 2 months ago

Hi everyone! I noticed that this issue has been open for a while, and there hasn't been any recent activity. If nobody is currently working on this, I would love to implement tags/annotations for bookmarked statuses. I am new to the Mastodon codebase, so any feedback on my ideas here would be greatly appreciated.

I want to build on what @mariotaku and @shaedrich proposed. Since we will probably want bookmarks to be able to have multiple labels (I will refer to the bookmark's tags as labels to separate them from the hashtags of statuses), I think we will need a new model for labels and a join table bookmark_labels. We could also use just a string array to store the labels for each bookmarked status, but using a separate model should speed up search times when searching/filtering bookmarks by one or more labels.

Here is the backend implementation that I am envisioning:

  1. Create a model for labels, and a join table bookmarks_labels.
  2. Permit labels in the statuses/bookmarks controller, and create an update action and route for bookmarked statuses to allow for bookmarks' labels to be changed.
  3. Create a scope on bookmarks to allow them to be filtered by labels.
  4. Create an endpoint to fetch all labels for a user's bookmarks, sorted by frequency.

Some things will also need to change on the frontend:

We will need to list the labels of a bookmarked status below the content of the status, potentially as chips. Also, when viewing bookmarked statuses, I am thinking that we could have chips corresponding to the most commonly used labels for the current user at the top of the feed. Clicking on a chip would add that label as a filter.

We will also need to allow for users to add labels to a status when they are bookmarking it. I am not sure what this dialogue should look like exactly, but it should at least pop a text box to prompt the user to add labels if they want. Could maybe just expand the status actions container to have a text box appear below the status actions to prompt for the labels for a less intrusive UX.

So this involves:

  1. Creating label chips, and adding these chips to the statuses, as well as to the top of the bookmarks feed for filtering.
  2. Create the ability to add labels to a bookmark when bookmarking a status, possibly by adding a textbox just below the status's actions after a user clicks on the bookmark icon.

I would love any feedback on these ideas, and please let me know if there are any existing considerations that I am overlooking.

Looking forward to contributing!

shaedrich commented 2 months ago

We will also need to allow for users to add labels to a status when they are bookmarking it. I am not sure what this dialogue should look like exactly, but it should at least pop a text box to prompt the user to add labels if they want. Could maybe just expand the status actions container to have a text box appear below the status actions to prompt for the labels for a less intrusive UX.

Maybe something along the lines of this, similar to GitHub's star lists: image

Also, the naming is important:

I will refer to the bookmark's tags as labels to separate them from the hashtags of statuses

donaldwilson8 commented 2 months ago

Thanks for the reply! I agree that the dropdown on GitHub's star lists is a great reference for the UI.

Regarding the naming, what do you think about "collections"? It seems fitting since the user is essentially creating collections of statuses to revisit later. I'm open to other ideas, but I think "collections" could clearly convey the purpose while avoiding confusion with existing features.

shaedrich commented 2 months ago

@donaldwilson8 Likewise! "Collections" sounds like a good idea 👍🏻 I'll add that to my list