Render reply trees with permission-aware inline controls, and move hunt, profile, voting, submission, and hiding flows to post storage.
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