Add list shared with user event
This commit is contained in:
parent
1c5dfb024b
commit
3f4fda1548
|
@ -105,3 +105,17 @@ type ListUpdatedEvent struct {
|
|||
func (l *ListUpdatedEvent) TopicName() string {
|
||||
return "list.updated"
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Sharing Events //
|
||||
////////////////////
|
||||
|
||||
type ListSharedWithUserEvent struct {
|
||||
List *List
|
||||
User *user.User
|
||||
Doer *user.User
|
||||
}
|
||||
|
||||
func (l *ListSharedWithUserEvent) TopicName() string {
|
||||
return "list.shared.user"
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"code.vikunja.io/api/pkg/events"
|
||||
"time"
|
||||
|
||||
"code.vikunja.io/api/pkg/user"
|
||||
|
@ -112,6 +113,19 @@ func (lu *ListUser) Create(s *xorm.Session, a web.Auth) (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
doer, err := user.GetFromAuth(a)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = events.Publish(&ListSharedWithUserEvent{
|
||||
List: l,
|
||||
User: u,
|
||||
Doer: doer,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = updateListLastUpdated(s, l)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue