Add nested posts UI (#5)
## Summary - Cut hunt, question, submission, voting, hiding, and profile flows over to unified posts - Render nested replies with permission-aware inline Reply/Edit controls and edited markers - Add post profile queries and the author index migration they depend on Co-authored-by: codegirl-007 <s.raide@gmail.com>
This commit was merged in pull request #5.
This commit is contained in:
@@ -141,6 +141,26 @@ func TestMemoryPostLifecycle(t *testing.T) {
|
||||
if err := mem.VotePost(ctx, voter.ID, later.ID, 1); !errors.Is(err, ErrPostNotVotable) {
|
||||
t.Fatalf("reply vote error = %v", err)
|
||||
}
|
||||
byAuthor, err := mem.ListRootPostsByAuthor(ctx, homeowner.ID)
|
||||
if err != nil || len(byAuthor) != 1 || byAuthor[0].ID != root.ID {
|
||||
t.Fatalf("roots by author = %+v, %v", byAuthor, err)
|
||||
}
|
||||
answeredBy, err := mem.ListRootPostsAnsweredBy(ctx, plumber.ID)
|
||||
if err != nil || len(answeredBy) != 1 || answeredBy[0].ID != root.ID {
|
||||
t.Fatalf("roots answered by admin = %+v, %v", answeredBy, err)
|
||||
}
|
||||
if err := mem.SetRootPostState(ctx, later.ID, PostStateHidden); !errors.Is(err, sql.ErrNoRows) {
|
||||
t.Fatalf("reply state error = %v, want sql.ErrNoRows", err)
|
||||
}
|
||||
if err := mem.SetRootPostState(ctx, root.ID, PostStateHidden); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if roots, err := mem.ListRootPostsByAuthor(ctx, homeowner.ID); err != nil || len(roots) != 0 {
|
||||
t.Fatalf("hidden author roots = %+v, %v", roots, err)
|
||||
}
|
||||
if roots, err := mem.ListRootPostsAnsweredBy(ctx, plumber.ID); err != nil || len(roots) != 0 {
|
||||
t.Fatalf("hidden answered roots = %+v, %v", roots, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMemoryPostValidation(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user