Skip to content

Commit 6d811bc

Browse files
6543lunny
authored andcommitted
Hide not allowed Reactions (#9387)
* Hide not allowed Reactions * filter in query :D * use ` Co-Authored-By: Alexey 〒erentyev <[email protected]> * update xorm v0.8.0 -> v0.8.1
1 parent 3b4682e commit 6d811bc

File tree

10 files changed

+150
-472
lines changed

10 files changed

+150
-472
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@ require (
111111
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
112112
xorm.io/builder v0.3.6
113113
xorm.io/core v0.7.2
114-
xorm.io/xorm v0.8.0
114+
xorm.io/xorm v0.8.1
115115
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,3 +791,5 @@ xorm.io/core v0.7.2 h1:mEO22A2Z7a3fPaZMk6gKL/jMD80iiyNwRrX5HOv3XLw=
791791
xorm.io/core v0.7.2/go.mod h1:jJfd0UAEzZ4t87nbQYtVjmqpIODugN6PD2D9E+dJvdM=
792792
xorm.io/xorm v0.8.0 h1:iALxgJrX8O00f8Jk22GbZwPmxJNgssV5Mv4uc2HL9PM=
793793
xorm.io/xorm v0.8.0/go.mod h1:ZkJLEYLoVyg7amJK/5r779bHyzs2AU8f8VMiP6BM7uY=
794+
xorm.io/xorm v0.8.1 h1:4f2KXuQxVdaX3RdI3Fw81NzMiSpZeyCZt8m3sEVeIkQ=
795+
xorm.io/xorm v0.8.1/go.mod h1:ZkJLEYLoVyg7amJK/5r779bHyzs2AU8f8VMiP6BM7uY=

integrations/api_issue_reaction_test.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func TestAPIIssuesReactions(t *testing.T) {
2626
session := loginUser(t, owner.Name)
2727
token := getTokenForLoggedInUser(t, session)
2828

29-
user1 := models.AssertExistsAndLoadBean(t, &models.User{ID: 1}).(*models.User)
3029
user2 := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
3130
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/reactions?token=%s",
3231
owner.Name, issue.Repo.Name, issue.Index, token)
@@ -61,17 +60,12 @@ func TestAPIIssuesReactions(t *testing.T) {
6160
DecodeJSON(t, resp, &apiReactions)
6261
expectResponse := make(map[int]api.ReactionResponse)
6362
expectResponse[0] = api.ReactionResponse{
64-
User: user1.APIFormat(),
65-
Reaction: "zzz",
66-
Created: time.Unix(1573248002, 0),
67-
}
68-
expectResponse[1] = api.ReactionResponse{
6963
User: user2.APIFormat(),
7064
Reaction: "eyes",
7165
Created: time.Unix(1573248003, 0),
7266
}
73-
expectResponse[2] = apiNewReaction
74-
assert.Len(t, apiReactions, 3)
67+
expectResponse[1] = apiNewReaction
68+
assert.Len(t, apiReactions, 2)
7569
for i, r := range apiReactions {
7670
assert.Equal(t, expectResponse[i].Reaction, r.Reaction)
7771
assert.Equal(t, expectResponse[i].Created.Unix(), r.Created.Unix())

models/issue_reaction.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func findReactions(e Engine, opts FindReactionsOptions) ([]*Reaction, error) {
6969
reactions := make([]*Reaction, 0, 10)
7070
sess := e.Where(opts.toConds())
7171
return reactions, sess.
72+
In("reaction.`type`", setting.UI.Reactions).
7273
Asc("reaction.issue_id", "reaction.comment_id", "reaction.created_unix", "reaction.id").
7374
Find(&reactions)
7475
}

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,5 +609,5 @@ strk.kbt.io/projects/go/libravatar
609609
xorm.io/builder
610610
# xorm.io/core v0.7.2
611611
xorm.io/core
612-
# xorm.io/xorm v0.8.0
612+
# xorm.io/xorm v0.8.1
613613
xorm.io/xorm

0 commit comments

Comments
 (0)