Add list updated event
This commit is contained in:
parent
90ec98ed23
commit
1c5dfb024b
|
@ -96,3 +96,12 @@ type ListCreatedEvent struct {
|
|||
func (l *ListCreatedEvent) TopicName() string {
|
||||
return "list.created"
|
||||
}
|
||||
|
||||
type ListUpdatedEvent struct {
|
||||
List *List
|
||||
Doer *user.User
|
||||
}
|
||||
|
||||
func (l *ListUpdatedEvent) TopicName() string {
|
||||
return "list.updated"
|
||||
}
|
||||
|
|
|
@ -543,7 +543,20 @@ func CreateOrUpdateList(s *xorm.Session, list *List, auth web.Auth) (err error)
|
|||
// @Failure 500 {object} models.Message "Internal error"
|
||||
// @Router /lists/{id} [post]
|
||||
func (l *List) Update(s *xorm.Session, a web.Auth) (err error) {
|
||||
return CreateOrUpdateList(s, l, a)
|
||||
err = CreateOrUpdateList(s, l, a)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
doer, err := user.GetFromAuth(a)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return events.Publish(&ListUpdatedEvent{
|
||||
List: l,
|
||||
Doer: doer,
|
||||
})
|
||||
}
|
||||
|
||||
func updateListLastUpdated(s *xorm.Session, list *List) error {
|
||||
|
|
Loading…
Reference in New Issue