fix(subscriptions): do not panic when a task does not have a subscription
(cherry picked from commit 75f3e930cd8072fc6709d1e653b177263d02c8ce)
This commit is contained in:
parent
8b8ec19bb3
commit
95ef4e1045
@ -171,7 +171,7 @@ func (sb *Subscription) Delete(s *xorm.Session, auth web.Auth) (err error) {
|
|||||||
|
|
||||||
func GetSubscriptionForUser(s *xorm.Session, entityType SubscriptionEntityType, entityID int64, a web.Auth) (subscription *SubscriptionWithUser, err error) {
|
func GetSubscriptionForUser(s *xorm.Session, entityType SubscriptionEntityType, entityID int64, a web.Auth) (subscription *SubscriptionWithUser, err error) {
|
||||||
u, is := a.(*user.User)
|
u, is := a.(*user.User)
|
||||||
if u != nil && !is {
|
if !is || u == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1577,7 +1577,9 @@ func (t *Task) ReadOne(s *xorm.Session, a web.Auth) (err error) {
|
|||||||
if err != nil && IsErrProjectDoesNotExist(err) {
|
if err != nil && IsErrProjectDoesNotExist(err) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if subs != nil {
|
||||||
t.Subscription = &subs.Subscription
|
t.Subscription = &subs.Subscription
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user