[1.0] Create report fails
Requirements
- [x] Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support or the matrix chat.
- [x] Did you check to see if this issue already exists?
- [x] Is this only a single bug? Do not put multiple bugs in one issue.
- [x] Do you agree to follow the rules in our Code of Conduct?
- [x] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
Summary
Creating post/comment reports often fails with this error:
[crates/api/api/src/reports/post_report/create.rs:68:16] PostReport::report(&mut context.pool(), &report_form).await = Err(
LemmyError {
message: CouldntCreate,
caller: /home/felix/workspace/lemmy/lemmy/crates/utils/src/error.rs:278:20,
inner: DatabaseError(
UniqueViolation,
"duplicate key value violates unique constraint \"post_report_post_id_creator_id_key\"",
),
},
)
[crates/api/api/src/reports/comment_report/create.rs:70:16] CommentReport::report(&mut context.pool(), &report_form).await = Err(
LemmyError {
message: CouldntCreate,
caller: /home/felix/workspace/lemmy/lemmy/crates/utils/src/error.rs:278:20,
inner: DatabaseError(
UniqueViolation,
"duplicate key value violates unique constraint \"comment_report_comment_id_creator_id_key\"",
),
},
)
As normal user report creation sometimes works, as admin it always seems to fail. Tested both locally and on voyager.
Not sure why this would be. We have both unit tests and federation tests for create comment and create post reports. This has to be a lemmy-ui issue then.
I looked in the front end code and didn't see anything obvious. The only thing I can think is that you already reported the item on your admin account, and obviously it doesn't let you report the same item twice.
Its not that, the problem also happens when reporting a new post. Seems like something is wrong with the db constraints, or maybe somewhere its passing a wrong id. Will debug it when I have the time.
I just tested this on voyager.lemmy.ml and couldn't replicate.
I also cant reproduce it anymore, closing.