fix(views): get tasks in saved filter
This commit is contained in:
parent
39c9928421
commit
7f1788eba9
@ -42,6 +42,8 @@ type TaskCollection struct {
|
|||||||
// If set to true, the result will also include null values
|
// If set to true, the result will also include null values
|
||||||
FilterIncludeNulls bool `query:"filter_include_nulls" json:"filter_include_nulls"`
|
FilterIncludeNulls bool `query:"filter_include_nulls" json:"filter_include_nulls"`
|
||||||
|
|
||||||
|
isSavedFilter bool
|
||||||
|
|
||||||
web.CRUDable `xorm:"-" json:"-"`
|
web.CRUDable `xorm:"-" json:"-"`
|
||||||
web.Rights `xorm:"-" json:"-"`
|
web.Rights `xorm:"-" json:"-"`
|
||||||
}
|
}
|
||||||
@ -152,7 +154,7 @@ func (tf *TaskCollection) ReadAll(s *xorm.Session, a web.Auth, search string, pa
|
|||||||
|
|
||||||
// If the project id is < -1 this means we're dealing with a saved filter - in that case we get and populate the filter
|
// If the project id is < -1 this means we're dealing with a saved filter - in that case we get and populate the filter
|
||||||
// -1 is the favorites project which works as intended
|
// -1 is the favorites project which works as intended
|
||||||
if tf.ProjectID < -1 {
|
if !tf.isSavedFilter && tf.ProjectID < -1 {
|
||||||
sf, err := getSavedFilterSimpleByID(s, getSavedFilterIDFromProjectID(tf.ProjectID))
|
sf, err := getSavedFilterSimpleByID(s, getSavedFilterIDFromProjectID(tf.ProjectID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, 0, err
|
return nil, 0, 0, err
|
||||||
@ -182,7 +184,12 @@ func (tf *TaskCollection) ReadAll(s *xorm.Session, a web.Auth, search string, pa
|
|||||||
sf.Filters.FilterTimezone = u.Timezone
|
sf.Filters.FilterTimezone = u.Timezone
|
||||||
}
|
}
|
||||||
|
|
||||||
return sf.getTaskCollection().ReadAll(s, a, search, page, perPage)
|
tc := sf.getTaskCollection()
|
||||||
|
tc.ProjectViewID = tf.ProjectViewID
|
||||||
|
tc.ProjectID = tf.ProjectID
|
||||||
|
tc.isSavedFilter = true
|
||||||
|
|
||||||
|
return tc.ReadAll(s, a, search, page, perPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
var view *ProjectView
|
var view *ProjectView
|
||||||
@ -230,7 +237,7 @@ func (tf *TaskCollection) ReadAll(s *xorm.Session, a web.Auth, search string, pa
|
|||||||
// If the project ID is not set, we get all tasks for the user.
|
// If the project ID is not set, we get all tasks for the user.
|
||||||
// This allows to use this function in Task.ReadAll with a possibility to deprecate the latter at some point.
|
// This allows to use this function in Task.ReadAll with a possibility to deprecate the latter at some point.
|
||||||
var projects []*Project
|
var projects []*Project
|
||||||
if tf.ProjectID == 0 {
|
if tf.ProjectID == 0 || tf.isSavedFilter {
|
||||||
projects, _, _, err = getRawProjectsForUser(
|
projects, _, _, err = getRawProjectsForUser(
|
||||||
s,
|
s,
|
||||||
&projectOptions{
|
&projectOptions{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user