Fixed a bug where deleting an attachment would cause a nil panic

This commit is contained in:
kolaente 2019-11-19 23:07:48 +01:00
parent c203d73b33
commit dcec9511dc
Signed by untrusted user who does not match committer: konrad
GPG key ID: F40E70337AB24C9B
3 changed files with 65 additions and 8 deletions

View file

@ -51,6 +51,11 @@ func (t *Task) CanRead(a web.Auth) (canRead bool, err error) {
return l.CanRead(a)
}
// CanWrite checks if a user has write access to a task
func (t *Task) CanWrite(a web.Auth) (canWrite bool, err error) {
return t.canDoTask(a)
}
// Helper function to check if a user can do stuff on a list task
func (t *Task) canDoTask(a web.Auth) (bool, error) {
// Get the task