lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Comments that are removed/deleted still return content

Open makotech222 opened this issue 2 years ago • 10 comments

If a comment is removed/deleted I think that the api should not return the CommentView.content field. Some third party frontends do not properly hide that content, and I think the intention if a user removes content should be that it is no longer public.

makotech222 avatar Jun 04 '23 15:06 makotech222

I believe that it is only returned if you are the comment creator, and possibly for admins/mods. Did you test this without login?

Nutomic avatar Jun 04 '23 20:06 Nutomic

We used to have a ton of overly-complicated code for overwriting these fields when the flag was deleted, but we got rid of it cause it was too complicated.

UIs should take note of the deleted / removed flags, and hide that content how they see fit.

If someone does find a way to implement this tho in a way that doesn't add a lot of code complication, I'd be fine with overwriting that.

dessalines avatar Jun 05 '23 18:06 dessalines

Ever considered dropping diesel? something like this is trivial in other ORMs i've worked with. Diesel has been probably the most difficult i've ever worked with and its so weak

makotech222 avatar Jun 05 '23 22:06 makotech222

What do you suggest? And how exactly is it easier than diesel?

Nutomic avatar Jun 05 '23 23:06 Nutomic

I know there are other orms for rust, just from casual browsing of programming forums, they seem to be more liked. Here's how c# efcore does it

image

Literally trivial. I would have no idea how to accomplish that in diesel cause its so incredibly rigid

makotech222 avatar Jun 05 '23 23:06 makotech222

That's also a post-select, code-manipulation solution to the problem. The correct solution to this should happen at the postgres / select layer.

Its probable that diesel can do proper postgres conditional case when selects, you'd just have to look into the diesel docs or ask them how to do this.

dessalines avatar Jun 06 '23 19:06 dessalines

Nope, all sql

image

makotech222 avatar Jun 06 '23 19:06 makotech222

Okay then, I'm not familiar with that library so it looked like the closure was moving the row results into them. Did you look into whether diesel supports case when conditionals?

dessalines avatar Jun 06 '23 19:06 dessalines

I'm wondering, wouldn't it be better to actually delete the content instead of just setting the flag?
And I mean in addition to the flag, so still have the row but the content will be empty (also for posts) plus the deleted flag.

Also, seems deletes aren't federated
You can see in here the comment in my instance has been deleted https://lemmy.pe1uca.dev/comment/13578
But it still shows up in other instances https://beehaw.org/comment/107195

pe1uca avatar Jun 09 '23 03:06 pe1uca

Deletes federate, but in a distributed system like Lemmy there is no guarantee that they will be delivered successfully.

Nutomic avatar Jun 09 '23 09:06 Nutomic