@@ -24,27 +24,27 @@ import (
24
24
)
25
25
26
26
func toBranchLink (act * models.Action ) string {
27
- return act .GetRepoLink () + "/src/branch/" + util .PathEscapeSegments (act .GetBranch ())
27
+ return act .GetRepoAbsoluteLink () + "/src/branch/" + util .PathEscapeSegments (act .GetBranch ())
28
28
}
29
29
30
30
func toTagLink (act * models.Action ) string {
31
- return act .GetRepoLink () + "/src/tag/" + util .PathEscapeSegments (act .GetTag ())
31
+ return act .GetRepoAbsoluteLink () + "/src/tag/" + util .PathEscapeSegments (act .GetTag ())
32
32
}
33
33
34
34
func toIssueLink (act * models.Action ) string {
35
- return act .GetRepoLink () + "/issues/" + url .PathEscape (act .GetIssueInfos ()[0 ])
35
+ return act .GetRepoAbsoluteLink () + "/issues/" + url .PathEscape (act .GetIssueInfos ()[0 ])
36
36
}
37
37
38
38
func toPullLink (act * models.Action ) string {
39
- return act .GetRepoLink () + "/pulls/" + url .PathEscape (act .GetIssueInfos ()[0 ])
39
+ return act .GetRepoAbsoluteLink () + "/pulls/" + url .PathEscape (act .GetIssueInfos ()[0 ])
40
40
}
41
41
42
42
func toSrcLink (act * models.Action ) string {
43
- return act .GetRepoLink () + "/src/" + util .PathEscapeSegments (act .GetBranch ())
43
+ return act .GetRepoAbsoluteLink () + "/src/" + util .PathEscapeSegments (act .GetBranch ())
44
44
}
45
45
46
46
func toReleaseLink (act * models.Action ) string {
47
- return act .GetRepoLink () + "/releases/tag/" + util .PathEscapeSegments (act .GetBranch ())
47
+ return act .GetRepoAbsoluteLink () + "/releases/tag/" + util .PathEscapeSegments (act .GetBranch ())
48
48
}
49
49
50
50
// renderMarkdown creates a minimal markdown render context from an action.
@@ -79,17 +79,17 @@ func feedActionsToFeedItems(ctx *context.Context, actions models.ActionList) (it
79
79
title = act .ActUser .DisplayName () + " "
80
80
switch act .OpType {
81
81
case models .ActionCreateRepo :
82
- title += ctx .TrHTMLEscapeArgs ("action.create_repo" , act .GetRepoLink (), act .ShortRepoPath ())
83
- link .Href = act .GetRepoLink ()
82
+ title += ctx .TrHTMLEscapeArgs ("action.create_repo" , act .GetRepoAbsoluteLink (), act .ShortRepoPath ())
83
+ link .Href = act .GetRepoAbsoluteLink ()
84
84
case models .ActionRenameRepo :
85
- title += ctx .TrHTMLEscapeArgs ("action.rename_repo" , act .GetContent (), act .GetRepoLink (), act .ShortRepoPath ())
86
- link .Href = act .GetRepoLink ()
85
+ title += ctx .TrHTMLEscapeArgs ("action.rename_repo" , act .GetContent (), act .GetRepoAbsoluteLink (), act .ShortRepoPath ())
86
+ link .Href = act .GetRepoAbsoluteLink ()
87
87
case models .ActionCommitRepo :
88
88
link .Href = toBranchLink (act )
89
89
if len (act .Content ) != 0 {
90
- title += ctx .TrHTMLEscapeArgs ("action.commit_repo" , act .GetRepoLink (), link .Href , act .GetBranch (), act .ShortRepoPath ())
90
+ title += ctx .TrHTMLEscapeArgs ("action.commit_repo" , act .GetRepoAbsoluteLink (), link .Href , act .GetBranch (), act .ShortRepoPath ())
91
91
} else {
92
- title += ctx .TrHTMLEscapeArgs ("action.create_branch" , act .GetRepoLink (), link .Href , act .GetBranch (), act .ShortRepoPath ())
92
+ title += ctx .TrHTMLEscapeArgs ("action.create_branch" , act .GetRepoAbsoluteLink (), link .Href , act .GetBranch (), act .ShortRepoPath ())
93
93
}
94
94
case models .ActionCreateIssue :
95
95
link .Href = toIssueLink (act )
@@ -98,11 +98,11 @@ func feedActionsToFeedItems(ctx *context.Context, actions models.ActionList) (it
98
98
link .Href = toPullLink (act )
99
99
title += ctx .TrHTMLEscapeArgs ("action.create_pull_request" , link .Href , act .GetIssueInfos ()[0 ], act .ShortRepoPath ())
100
100
case models .ActionTransferRepo :
101
- link .Href = act .GetRepoLink ()
102
- title += ctx .TrHTMLEscapeArgs ("action.transfer_repo" , act .GetContent (), act .GetRepoLink (), act .ShortRepoPath ())
101
+ link .Href = act .GetRepoAbsoluteLink ()
102
+ title += ctx .TrHTMLEscapeArgs ("action.transfer_repo" , act .GetContent (), act .GetRepoAbsoluteLink (), act .ShortRepoPath ())
103
103
case models .ActionPushTag :
104
104
link .Href = toTagLink (act )
105
- title += ctx .TrHTMLEscapeArgs ("action.push_tag" , act .GetRepoLink (), link .Href , act .GetTag (), act .ShortRepoPath ())
105
+ title += ctx .TrHTMLEscapeArgs ("action.push_tag" , act .GetRepoAbsoluteLink (), link .Href , act .GetTag (), act .ShortRepoPath ())
106
106
case models .ActionCommentIssue :
107
107
issueLink := toIssueLink (act )
108
108
if link .Href == "#" {
@@ -140,26 +140,26 @@ func feedActionsToFeedItems(ctx *context.Context, actions models.ActionList) (it
140
140
}
141
141
title += ctx .TrHTMLEscapeArgs ("action.reopen_pull_request" , pullLink , act .GetIssueInfos ()[0 ], act .ShortRepoPath ())
142
142
case models .ActionDeleteTag :
143
- link .Href = act .GetRepoLink ()
144
- title += ctx .TrHTMLEscapeArgs ("action.delete_tag" , act .GetRepoLink (), act .GetTag (), act .ShortRepoPath ())
143
+ link .Href = act .GetRepoAbsoluteLink ()
144
+ title += ctx .TrHTMLEscapeArgs ("action.delete_tag" , act .GetRepoAbsoluteLink (), act .GetTag (), act .ShortRepoPath ())
145
145
case models .ActionDeleteBranch :
146
- link .Href = act .GetRepoLink ()
147
- title += ctx .TrHTMLEscapeArgs ("action.delete_branch" , act .GetRepoLink (), html .EscapeString (act .GetBranch ()), act .ShortRepoPath ())
146
+ link .Href = act .GetRepoAbsoluteLink ()
147
+ title += ctx .TrHTMLEscapeArgs ("action.delete_branch" , act .GetRepoAbsoluteLink (), html .EscapeString (act .GetBranch ()), act .ShortRepoPath ())
148
148
case models .ActionMirrorSyncPush :
149
149
srcLink := toSrcLink (act )
150
150
if link .Href == "#" {
151
151
link .Href = srcLink
152
152
}
153
- title += ctx .TrHTMLEscapeArgs ("action.mirror_sync_push" , act .GetRepoLink (), srcLink , act .GetBranch (), act .ShortRepoPath ())
153
+ title += ctx .TrHTMLEscapeArgs ("action.mirror_sync_push" , act .GetRepoAbsoluteLink (), srcLink , act .GetBranch (), act .ShortRepoPath ())
154
154
case models .ActionMirrorSyncCreate :
155
155
srcLink := toSrcLink (act )
156
156
if link .Href == "#" {
157
157
link .Href = srcLink
158
158
}
159
- title += ctx .TrHTMLEscapeArgs ("action.mirror_sync_create" , act .GetRepoLink (), srcLink , act .GetBranch (), act .ShortRepoPath ())
159
+ title += ctx .TrHTMLEscapeArgs ("action.mirror_sync_create" , act .GetRepoAbsoluteLink (), srcLink , act .GetBranch (), act .ShortRepoPath ())
160
160
case models .ActionMirrorSyncDelete :
161
- link .Href = act .GetRepoLink ()
162
- title += ctx .TrHTMLEscapeArgs ("action.mirror_sync_delete" , act .GetRepoLink (), act .GetBranch (), act .ShortRepoPath ())
161
+ link .Href = act .GetRepoAbsoluteLink ()
162
+ title += ctx .TrHTMLEscapeArgs ("action.mirror_sync_delete" , act .GetRepoAbsoluteLink (), act .GetBranch (), act .ShortRepoPath ())
163
163
case models .ActionApprovePullRequest :
164
164
pullLink := toPullLink (act )
165
165
title += ctx .TrHTMLEscapeArgs ("action.approve_pull_request" , pullLink , act .GetIssueInfos ()[0 ], act .ShortRepoPath ())
@@ -174,16 +174,16 @@ func feedActionsToFeedItems(ctx *context.Context, actions models.ActionList) (it
174
174
if link .Href == "#" {
175
175
link .Href = releaseLink
176
176
}
177
- title += ctx .TrHTMLEscapeArgs ("action.publish_release" , act .GetRepoLink (), releaseLink , act .ShortRepoPath (), act .Content )
177
+ title += ctx .TrHTMLEscapeArgs ("action.publish_release" , act .GetRepoAbsoluteLink (), releaseLink , act .ShortRepoPath (), act .Content )
178
178
case models .ActionPullReviewDismissed :
179
179
pullLink := toPullLink (act )
180
180
title += ctx .TrHTMLEscapeArgs ("action.review_dismissed" , pullLink , act .GetIssueInfos ()[0 ], act .ShortRepoPath (), act .GetIssueInfos ()[1 ])
181
181
case models .ActionStarRepo :
182
- link .Href = act .GetRepoLink ()
183
- title += ctx .TrHTMLEscapeArgs ("action.starred_repo" , act .GetRepoLink (), act .GetRepoPath ())
182
+ link .Href = act .GetRepoAbsoluteLink ()
183
+ title += ctx .TrHTMLEscapeArgs ("action.starred_repo" , act .GetRepoAbsoluteLink (), act .GetRepoPath ())
184
184
case models .ActionWatchRepo :
185
- link .Href = act .GetRepoLink ()
186
- title += ctx .TrHTMLEscapeArgs ("action.watched_repo" , act .GetRepoLink (), act .GetRepoPath ())
185
+ link .Href = act .GetRepoAbsoluteLink ()
186
+ title += ctx .TrHTMLEscapeArgs ("action.watched_repo" , act .GetRepoAbsoluteLink (), act .GetRepoPath ())
187
187
default :
188
188
return nil , fmt .Errorf ("unknown action type: %v" , act .OpType )
189
189
}
@@ -193,14 +193,14 @@ func feedActionsToFeedItems(ctx *context.Context, actions models.ActionList) (it
193
193
switch act .OpType {
194
194
case models .ActionCommitRepo , models .ActionMirrorSyncPush :
195
195
push := templates .ActionContent2Commits (act )
196
- repoLink := act .GetRepoLink ()
196
+ repoLink := act .GetRepoAbsoluteLink ()
197
197
198
198
for _ , commit := range push .Commits {
199
199
if len (desc ) != 0 {
200
200
desc += "\n \n "
201
201
}
202
202
desc += fmt .Sprintf ("<a href=\" %s\" >%s</a>\n %s" ,
203
- html .EscapeString (fmt .Sprintf ("%s/commit/%s" , act .GetRepoLink (), commit .Sha1 )),
203
+ html .EscapeString (fmt .Sprintf ("%s/commit/%s" , act .GetRepoAbsoluteLink (), commit .Sha1 )),
204
204
commit .Sha1 ,
205
205
templates .RenderCommitMessage (ctx , commit .Message , repoLink , nil ),
206
206
)
@@ -209,7 +209,7 @@ func feedActionsToFeedItems(ctx *context.Context, actions models.ActionList) (it
209
209
if push .Len > 1 {
210
210
link = & feeds.Link {Href : fmt .Sprintf ("%s/%s" , setting .AppSubURL , push .CompareURL )}
211
211
} else if push .Len == 1 {
212
- link = & feeds.Link {Href : fmt .Sprintf ("%s/commit/%s" , act .GetRepoLink (), push .Commits [0 ].Sha1 )}
212
+ link = & feeds.Link {Href : fmt .Sprintf ("%s/commit/%s" , act .GetRepoAbsoluteLink (), push .Commits [0 ].Sha1 )}
213
213
}
214
214
215
215
case models .ActionCreateIssue , models .ActionCreatePullRequest :
0 commit comments