@@ -57,8 +57,8 @@ func (err ErrReactionAlreadyExist) Unwrap() error {
5757 return util .ErrAlreadyExist
5858}
5959
60- // Reaction represents a reactions on conversations and comments.
61- type Reaction struct {
60+ // CommentReaction represents a reactions on conversations and comments.
61+ type CommentReaction struct {
6262 ID int64 `xorm:"pk autoincr"`
6363 Type string `xorm:"INDEX UNIQUE(s) NOT NULL"`
6464 ConversationID int64 `xorm:"INDEX UNIQUE(s) NOT NULL"`
@@ -71,7 +71,7 @@ type Reaction struct {
7171}
7272
7373// LoadUser load user of reaction
74- func (r * Reaction ) LoadUser (ctx context.Context ) (* user_model.User , error ) {
74+ func (r * CommentReaction ) LoadUser (ctx context.Context ) (* user_model.User , error ) {
7575 if r .User != nil {
7676 return r .User , nil
7777 }
@@ -84,24 +84,24 @@ func (r *Reaction) LoadUser(ctx context.Context) (*user_model.User, error) {
8484}
8585
8686// RemapExternalUser ExternalUserRemappable interface
87- func (r * Reaction ) RemapExternalUser (externalName string , externalID , userID int64 ) error {
87+ func (r * CommentReaction ) RemapExternalUser (externalName string , externalID , userID int64 ) error {
8888 r .OriginalAuthor = externalName
8989 r .OriginalAuthorID = externalID
9090 r .UserID = userID
9191 return nil
9292}
9393
9494// GetUserID ExternalUserRemappable interface
95- func (r * Reaction ) GetUserID () int64 { return r .UserID }
95+ func (r * CommentReaction ) GetUserID () int64 { return r .UserID }
9696
9797// GetExternalName ExternalUserRemappable interface
98- func (r * Reaction ) GetExternalName () string { return r .OriginalAuthor }
98+ func (r * CommentReaction ) GetExternalName () string { return r .OriginalAuthor }
9999
100100// GetExternalID ExternalUserRemappable interface
101- func (r * Reaction ) GetExternalID () int64 { return r .OriginalAuthorID }
101+ func (r * CommentReaction ) GetExternalID () int64 { return r .OriginalAuthorID }
102102
103103func init () {
104- db .RegisterModel (new (Reaction ))
104+ db .RegisterModel (new (CommentReaction ))
105105}
106106
107107// FindReactionsOptions describes the conditions to Find reactions
@@ -166,18 +166,18 @@ func FindReactions(ctx context.Context, opts FindReactionsOptions) (ReactionList
166166 if opts .Page != 0 {
167167 sess = db .SetSessionPagination (sess , & opts )
168168
169- reactions := make ([]* Reaction , 0 , opts .PageSize )
169+ reactions := make ([]* CommentReaction , 0 , opts .PageSize )
170170 count , err := sess .FindAndCount (& reactions )
171171 return reactions , count , err
172172 }
173173
174- reactions := make ([]* Reaction , 0 , 10 )
174+ reactions := make ([]* CommentReaction , 0 , 10 )
175175 count , err := sess .FindAndCount (& reactions )
176176 return reactions , count , err
177177}
178178
179- func createReaction (ctx context.Context , opts * ReactionOptions ) (* Reaction , error ) {
180- reaction := & Reaction {
179+ func createReaction (ctx context.Context , opts * ReactionOptions ) (* CommentReaction , error ) {
180+ reaction := & CommentReaction {
181181 Type : opts .Type ,
182182 UserID : opts .DoerID ,
183183 ConversationID : opts .ConversationID ,
@@ -218,7 +218,7 @@ type ReactionOptions struct {
218218}
219219
220220// CreateReaction creates reaction for conversation or comment.
221- func CreateReaction (ctx context.Context , opts * ReactionOptions ) (* Reaction , error ) {
221+ func CreateReaction (ctx context.Context , opts * ReactionOptions ) (* CommentReaction , error ) {
222222 if ! setting .UI .ReactionsLookup .Contains (opts .Type ) {
223223 return nil , ErrForbiddenConversationReaction {opts .Type }
224224 }
@@ -242,7 +242,7 @@ func CreateReaction(ctx context.Context, opts *ReactionOptions) (*Reaction, erro
242242
243243// DeleteReaction deletes reaction for conversation or comment.
244244func DeleteReaction (ctx context.Context , opts * ReactionOptions ) error {
245- reaction := & Reaction {
245+ reaction := & CommentReaction {
246246 Type : opts .Type ,
247247 UserID : opts .DoerID ,
248248 ConversationID : opts .ConversationID ,
@@ -280,7 +280,7 @@ func DeleteCommentReaction(ctx context.Context, doerID, conversationID, commentI
280280}
281281
282282// ReactionList represents list of reactions
283- type ReactionList []* Reaction
283+ type ReactionList []* CommentReaction
284284
285285// HasUser check if user has reacted
286286func (list ReactionList ) HasUser (userID int64 ) bool {
@@ -305,7 +305,7 @@ func (list ReactionList) GroupByType() map[string]ReactionList {
305305}
306306
307307func (list ReactionList ) getUserIDs () []int64 {
308- return container .FilterSlice (list , func (reaction * Reaction ) (int64 , bool ) {
308+ return container .FilterSlice (list , func (reaction * CommentReaction ) (int64 , bool ) {
309309 if reaction .OriginalAuthor != "" {
310310 return 0 , false
311311 }
0 commit comments