Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Community post tags (part 1) #4997

wants to merge 7 commits into from

Conversation

phiresky
Copy link
Collaborator

@phiresky phiresky commented Sep 2, 2024

This is the first part of an implementation of post tags based on LemmyNet/rfcs#4.

It implements the following:

  • The necessary DB tables
  • Fetching the post tags while reading PostView (list and single)
  • Tests for the above

What is missing:

  • New API methods (for fetching tags of a community (public) and for updating post tags (creator+mods)
  • Updated post create method (for adding tags directly when posting
  • Filtering by post tag in post view (I would consider this out of scope for now)
  • Federation of tags and tag updates
  • The frontend (select tags on post creation+edit and show post tags in post listings)

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:

  • Table naming: Currently I name the table that contains the data 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 example global_post_tag for tags that are the same / interpretable globally (like NSFW). The n:m association table is called post_community_post_tag (post_id, tag_id).
  • The way the tags of a post are fetched. See the comment in the post_view code

CREATE TABLE community_post_tag (
id serial PRIMARY KEY,
ap_id text NOT NULL UNIQUE,
community_id int NOT NULL REFERENCES community (id) ON UPDATE CASCADE ON DELETE CASCADE,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this linking column, and create a new table called community_post_tag, with a primary key of (community_id, tag_id) . Also add a published column

Check out any of the other bridge tables, like post_read, community_block, etc for examples.

src/api_routes_http.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants