Favorite tasks (#653)
Fixed namespace tests Add test for favorite tasks Fix favorite tasks not being updated Fix integration tests Fix lint Return a pseudo namespace and list for favorites Make sure users can only see their favorites Add condition show tasks from the favorites list Regenerate swagger docs Add favorite field to task Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/653
This commit is contained in:
@ -66,6 +66,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||
CreatedBy: user1,
|
||||
ListID: 1,
|
||||
BucketID: 1,
|
||||
IsFavorite: true,
|
||||
Labels: []*Label{
|
||||
{
|
||||
ID: 4,
|
||||
@ -288,6 +289,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||
CreatedByID: 6,
|
||||
CreatedBy: user6,
|
||||
ListID: 6,
|
||||
IsFavorite: true,
|
||||
RelatedTasks: map[RelationKind][]*Task{},
|
||||
BucketID: 6,
|
||||
Created: time.Unix(1543626724, 0).In(loc),
|
||||
@ -484,6 +486,7 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||
Index: 1,
|
||||
CreatedByID: 1,
|
||||
ListID: 1,
|
||||
IsFavorite: true,
|
||||
Created: time.Unix(1543626724, 0).In(loc),
|
||||
Updated: time.Unix(1543626724, 0).In(loc),
|
||||
BucketID: 1,
|
||||
@ -836,6 +839,18 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "favorited tasks",
|
||||
args: defaultArgs,
|
||||
fields: fields{
|
||||
ListID: FavoritesPseudoList.ID,
|
||||
},
|
||||
want: []*Task{
|
||||
task1,
|
||||
task15,
|
||||
// Task 34 is also a favorite, but on a list user 1 has no access to.
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
Reference in New Issue
Block a user