From 35f05cbbec6a39eec3641102d1afce44b12e67bc Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 22 Mar 2020 21:39:57 +0100 Subject: [PATCH] Show lists as archived if their namespace is archived Signed-off-by: kolaente --- pkg/models/list.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/models/list.go b/pkg/models/list.go index 3764f95723..1cbb0eb1ba 100644 --- a/pkg/models/list.go +++ b/pkg/models/list.go @@ -149,7 +149,20 @@ func (l *List) ReadAll(a web.Auth, search string, page int, perPage int) (result func (l *List) ReadOne() (err error) { // Get list owner l.Owner, err = user.GetUserByID(l.OwnerID) - return + if err != nil { + return err + } + // Check if the namespace is archived and set the namespace to archived if it is not already archived individually. + if !l.IsArchived { + err = l.CheckIsArchived() + if err != nil { + if !IsErrNamespaceIsArchived(err) && !IsErrListIsArchived(err) { + return + } + l.IsArchived = true + } + } + return nil } // GetSimpleByID gets a list with only the basic items, aka no tasks or user objects. Returns an error if the list does not exist.