-
-
Notifications
You must be signed in to change notification settings - Fork 902
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 1) #4997
Conversation
I've updated the implementation based on the comments:
the tag table should thus work for creating other types of tags later. i don't think it's perfectly optimal, because the tag table itself might become overloaded with optionals or hard to manage at some point. but it's probably a fine start. @Nutomic @dessalines please let me know what you think |
pub ap_id: DbUrl, | ||
pub name: String, | ||
// default now | ||
pub published: Option<DateTime<Utc>>, |
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.
If it has a default you can leave out the field here.
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 looked at a few of our other forms, PostInsertForm
, CommentInsertForm
, and they all have it (probably for activitypub reasons, ie overriding the published date based on when it was created in the first database, not when it got federated)
} | ||
|
||
#[test_context(Data)] |
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 looks good!
pub ap_id: DbUrl, | ||
pub name: String, | ||
// default now | ||
pub published: Option<DateTime<Utc>>, |
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 looked at a few of our other forms, PostInsertForm
, CommentInsertForm
, and they all have it (probably for activitypub reasons, ie overriding the published date based on when it was created in the first database, not when it got federated)
Let me summarize my interpretation of everyone's position on the DB design:
Personally, I see arguments for all options and don't have a strong opinion. I also don't think it's actually that important, because IF/when we add more tag types, migrating to what will only then be revealed as the best idea won't be too difficult. So I really just need something that everyone will approve before I make further changes, because I don't want to keep ping-ponging around. |
Thx for summarizing. I def think we should keep a generic
I personally think option 1) is a little better, as we can use the DB to enforce what tags are allowed for that item (and for example, a Option 2 is definitely easier, because everything only needs to reference the I'm good with either one. They both work and option 2 is probably simpler, so if you want to go with that, that works for me too. |
I really fail to understand what would be the purpose of the generic To me this is really similar to the db structure for votes. Sure we could have a single |
I think the difficulty is that we don't know yet, and we can't without already sketching out the design of a second tag type, which we don't want to do. So it can go either way later, either we realize we should have made it more generic, or that we should have made it more specific. One thing I like that I saw after changing the code, is that I think it makes a lot of sense to have the field in My suggestion would be to go for what dullbananas wrote / suggestion (2) from dess above: A table called tags, with a Please let me know @Nutomic if you'll approve that because the other two have already said so.
Just a note, the authority that manages the metadata of a Tag object is not necessarily the same as the authority that manages the object-tag relationship. An NSFW tag for example could be a lemmy-global tag with a global description/meaning, but associating it to posts can be managed by individual communities.
Yes, adding tag-specific fields to that table makes no sense. But metadata on a tag would be things like "creation date", "human readable description of the tag", "author of the tag", "category of the tag (see hierarchical tags discussion)", "federation audience", etc. |
Really though, ignore most of my message, ideally I want you to just say yes. We are spending a lot of time on this and it's not really being productive. Your concerns are not wrong, just no one has the real answers and we can not have them at this stage. At this point we are wasting more time on this than if we simply chose a random solution and then refactored it later in the 20% chance that a different option is significantly better. And my motivation to work on this is fading because of the circularity. |
Thats fine, Im not concerned about the naming of specific api fields.
Thats close to what Im saying too. But as we dont have any other tag types for now, the community_id column should be not null. Later we can change it to be nullable if that makes sense, and/or add some |
Sure, sounds fine. Then I'll do it as described above, and community_id will not be nullable (for now). |
I've made the changes and fixed the comments. Please re-review and we can merge. |
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.
Looks good so far. Im a bit sceptical about merging a partial PR like this which doesnt require all the needed changes (api/federation), but we can give it a try. Anyway the main branch is unstable now.
This is the first part of an implementation of post tags based on LemmyNet/rfcs#4.
It implements the following:
What is missing:
I would like to propose that we work on and merge this (and potentially other larger changes) in multiple parts, as soon as each part is ready and ofc doesn't negatively affect the existing functionality. That way the branches don't live for months and diverge more and more and each chunk stays simple and can be reviewed quickly.
There's some somewhat open questions wrt this code:
community_post_tag (id, apub_id, name, url)
so it's clear this is a tag that belongs to one community and tags posts in that community. This way we can later more tag types that may have different meanings and especially different properties and access control. For exampleglobal_post_tag
for tags that are the same / interpretable globally (like NSFW). The n:m association table is calledpost_community_post_tag (post_id, tag_id)
.