-
-
Notifications
You must be signed in to change notification settings - Fork 917
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
Community post tags (part 2: API methods) #5389
base: main
Are you sure you want to change the base?
Conversation
Ready for review. the API tests pass locally for me, but require merging LemmyNet/lemmy-js-client#483 |
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.
What's the slug thing about? The tag already has a name and an ap_id.
Do the re-request review when you want me to have another look. I thought about going through it but I'm guessing its still WIP. |
222d18f
to
1b3e8b0
Compare
I've updated the PR
I'll merge main after reviews are green |
b6013a1
to
8d8a2ad
Compare
i've temporarily set the lemmy-js-client lib to point to this pr LemmyNet/lemmy-js-client#483 so that the tests pass. please re-review |
@phiresky The discussion at the top about table names is not resolved yet. If you have better ideas how to name them thats fine, but right now the names dont make it clear what these tables and structs are for. |
@Nutomic the discussion you linked is about the API path, which is resolved. Tables are not even part of this PR. |
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.
Yes the tables were in #4997 which is part of the same feature. In that PR it wasnt clear yet how it all works, only now is it possible to review properly. So Im repeating my request again:
Yes it all needs to be made more consistent. For the main tags table community_tags makes sense, while the relation tag-post can be represented by a table community_tags_for_post.
Here's that discussion, and I believe that we agreed on leaving a generic So I don't believe any tag table changes (or new tables) are necessary, outside of possibly adding a |
Alright then leave the table names like this, but do add comments on the db structs to make it clear what they are for. |
crates/db_schema/src/source/tag.rs
Outdated
/// | ||
/// A tag is a federatable object that gives additional context to another object, which can be | ||
/// displayed and filtered on. Currently, we only have community post tags, which is a tag that is | ||
/// created by post authors as well as mods of a community, to categorize a post. |
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.
Tags can only be created by mods (or admins).
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.
Thanks. I've clarified this
Sorry I missed those comments, its not easy to review these split PRs. |
@@ -6,7 +6,7 @@ | |||
CREATE TABLE tag ( | |||
id serial PRIMARY KEY, | |||
ap_id text NOT NULL UNIQUE, | |||
name text NOT NULL, | |||
display_name text NOT NULL, |
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.
This still isn't right, check either the person table (or community table)
- name varchar(255) not null
- display_name varchar(255) nullable
Whether its varchar or text doesn't matter to me, but having a required name, and an optional display_name, is what I was referring to. The name will be the no-spaces, url-safe version, and the display name is optional, and can be whatever.
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.
that's what id_slug was but you said I should remove it 😂 and why would we need a second name? it's already included in the URL so it would be redundant. no point complicating things
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.
iirc id_slug wasn't actually on the table. The display name is to allow spaces and other non-url characters (if they want), and should be optional (with UIs defaulting to showing the tag name if display name is null). I think its a good idea to have, I could see tag display names getting complicated and people would want to use more complicated ones.
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.
yes you're right, I only had that in the creation UI because that was an additional feature, having it in the DB would have been redundant.
The display name is to allow spaces and other non-url characters
yes but that's what display name already is. the question is why would you need another copy of a name that is simpler? how would that look in the UI? when would it be displayed? for what purpose would it be used? would it be modifiable? what if the two names mean completely different things?
this seems like a whole new feature that i don't understand
it's also not part of the rfc fwiw.
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.
It'd be just like person names and person display names. The tag name (that doesn't allow spaces and such), could be useful for URLs, searching, tagging, etc. Sometimes people like to flair up their display names with weird characters and spaces, but their person name is a simple searchable text.
Lets say in the future we create a way to filter a community posts by tags: IE /c/asklemmy?tag=?
That's going to be a lot easier if its a url-safe name. But when we show the post tags somewhere, we'd always use the display name.
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.
i'd expect the tag=x in an url to be the id (numeric). otherwise you have three (!) ids you need to be able to query by (id, ap_url, name) which seems excessive to me for a tiny benefit
person name seems like a pretty different thing to me because "username" is a very well known concept and connected to identity, but tags are a pretty different thing
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 tag slug could be used to include a reference to the tag that automatically links to a view of posts that have that tag, just like a person mention. If a search bar is added to post views in the future, then a realistic use case of tag slugs would be including a link to the "question" tag in text that tells users to check existing questions before posting a new one.
As a separate change, removing slugs from everything would be good if:
- The name is shown where the slug is currently shown (including in URLs, as an optional part after the numeric id) (not guaranteed on other instances that the object federates to, which might be a problem)
- The name doesn't become the thing that has to stay the same in order to not break links
- The UX for inserting a mention stays just as good (this may or may not be possible)
This is the second part of post tags, implementing the API methods.
Database PR (merged): #4997
Original RFC: LemmyNet/rfcs#4