feat: emoji reactions for tasks and comments #2196

Merged
konrad merged 19 commits from feature/reactions into main 2024-03-12 19:26:01 +00:00
Showing only changes of commit a2fa1515cd - Show all commits

View File

@ -37,6 +37,8 @@ type TaskComment struct {
Author *user.User `xorm:"-" json:"author"`
TaskID int64 `xorm:"not null" json:"-" param:"task"`
Reactions ReactionMap `xorm:"-" json:"reactions"`
Created time.Time `xorm:"created" json:"created"`
Updated time.Time `xorm:"updated" json:"updated"`
@ -263,8 +265,10 @@ func (tc *TaskComment) ReadAll(s *xorm.Session, auth web.Auth, search string, pa
}
var authorIDs []int64
var commentIDs []int64
for _, comment := range comments {
authorIDs = append(authorIDs, comment.AuthorID)
commentIDs = append(commentIDs, comment.ID)
}
authors, err := getUsersOrLinkSharesFromIDs(s, authorIDs)
@ -272,8 +276,17 @@ func (tc *TaskComment) ReadAll(s *xorm.Session, auth web.Auth, search string, pa
return
}
reactions, err := getReactionsForEntityIDs(s, ReactionKindTask, commentIDs)
if err != nil {
return
}
for _, comment := range comments {
comment.Author = authors[comment.AuthorID]
r, has := reactions[comment.ID]
if has {
comment.Reactions = r
}
}
numberOfTotalItems, err = s.