Skip to content

Commit 8f2aebd

Browse files
committed
follow @delvh suggestion
1 parent dcf0d8d commit 8f2aebd

File tree

10 files changed

+15
-14
lines changed

10 files changed

+15
-14
lines changed

models/activities/notification.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ func (n *Notification) HTMLURL() string {
459459
return ""
460460
}
461461

462-
// Link formats a URL-string to the notification
462+
// Link formats a relative URL-string to the notification
463463
func (n *Notification) Link() string {
464464
switch n.Source {
465465
case NotificationSourceIssue, NotificationSourcePullRequest:

models/issues/comment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ func (c *Comment) HTMLURL() string {
394394
return c.Issue.HTMLURL() + c.hashLink()
395395
}
396396

397-
// Link formats a URL-string to the issue-comment
397+
// Link formats a relative URL-string to the issue-comment
398398
func (c *Comment) Link() string {
399399
err := c.LoadIssue(db.DefaultContext)
400400
if err != nil { // Silently dropping errors :unamused:

models/issues/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ func (issue *Issue) HTMLURL() string {
419419
return fmt.Sprintf("%s/%s/%d", issue.Repo.HTMLURL(), path, issue.Index)
420420
}
421421

422-
// Link returns the Link URL to this issue.
422+
// Link returns the issue's relative URL.
423423
func (issue *Issue) Link() string {
424424
var path string
425425
if issue.IsPull {

models/issues/pull.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ func GetPullRequestsByHeadBranch(ctx context.Context, headBranch string, headRep
695695
return prs, nil
696696
}
697697

698-
// GetBaseBranchLink returns the relative HTML URL of the base branch
698+
// GetBaseBranchLink returns the relative URL of the base branch
699699
func (pr *PullRequest) GetBaseBranchLink() string {
700700
if err := pr.LoadBaseRepo(db.DefaultContext); err != nil {
701701
log.Error("LoadBaseRepo: %v", err)
@@ -707,7 +707,7 @@ func (pr *PullRequest) GetBaseBranchLink() string {
707707
return pr.BaseRepo.Link() + "/src/branch/" + util.PathEscapeSegments(pr.BaseBranch)
708708
}
709709

710-
// GetHeadBranchLink returns the relative HTML URL of the head branch
710+
// GetHeadBranchLink returns the relative URL of the head branch
711711
func (pr *PullRequest) GetHeadBranchLink() string {
712712
if pr.Flow == PullRequestFlowAGit {
713713
return ""

models/project/project.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ func (p *Project) LoadRepo(ctx context.Context) (err error) {
116116
return err
117117
}
118118

119+
// Link returns the project's relative URL.
119120
func (p *Project) Link() string {
120121
if p.OwnerID > 0 {
121122
err := p.LoadOwner(db.DefaultContext)

models/repo/release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func (r *Release) HTMLURL() string {
130130
return r.Repo.HTMLURL() + "/releases/tag/" + util.PathEscapeSegments(r.TagName)
131131
}
132132

133-
// Link the url for a release on the web UI. release must have attributes loaded
133+
// Link the relative url for a release on the web UI. release must have attributes loaded
134134
func (r *Release) Link() string {
135135
return r.Repo.Link() + "/releases/tag/" + util.PathEscapeSegments(r.TagName)
136136
}

models/repo/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ func (repo *Repository) RepoPath() string {
481481
return RepoPath(repo.OwnerName, repo.Name)
482482
}
483483

484-
// Link returns the repository link
484+
// Link returns the repository relative url
485485
func (repo *Repository) Link() string {
486486
return setting.AppSubURL + "/" + url.PathEscape(repo.OwnerName) + "/" + url.PathEscape(repo.Name)
487487
}

web_src/js/features/clipboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {showTemporaryTooltip} from '../modules/tippy.js';
2-
import {getCurAbsUrl} from '../utils.js';
2+
import {toAbsoluteUrl} from '../utils.js';
33

44
const {copy_success, copy_error} = window.config.i18n;
55

@@ -53,7 +53,7 @@ export function initGlobalCopyToClipboardListener() {
5353
for (let i = 0; i < 3 && target; i++) {
5454
let txt = target.getAttribute('data-clipboard-text');
5555
if (txt && target.getAttribute('data-clipboard-text-type') === 'url') {
56-
txt = getCurAbsUrl(txt);
56+
txt = toAbsoluteUrl(txt);
5757
}
5858
const text = txt || document.querySelector(target.getAttribute('data-clipboard-target'))?.value;
5959

web_src/js/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export function convertImage(blob, mime) {
134134
});
135135
}
136136

137-
export function getCurAbsUrl(relUrl) {
137+
export function toAbsoluteUrl(relUrl) {
138138
if (relUrl.startsWith('http://') || relUrl.startsWith('https://')) {
139139
return relUrl;
140140
}

web_src/js/utils.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {expect, test} from 'vitest';
22
import {
33
basename, extname, isObject, uniq, stripTags, joinPaths, parseIssueHref,
44
prettyNumber, parseUrl, translateMonth, translateDay, blobToDataURI,
5-
getCurAbsUrl,
5+
toAbsoluteUrl,
66
} from './utils.js';
77

88
test('basename', () => {
@@ -138,7 +138,7 @@ test('blobToDataURI', async () => {
138138
expect(await blobToDataURI(blob)).toEqual('data:application/json;base64,eyJ0ZXN0Ijp0cnVlfQ==');
139139
});
140140

141-
test('getCurAbsUrl', () => {
142-
expect(getCurAbsUrl('')).toEqual('http://localhost:3000');
143-
expect(getCurAbsUrl('/user/repo')).toEqual('http://localhost:3000/user/repo');
141+
test('toAbsoluteUrl', () => {
142+
expect(toAbsoluteUrl('')).toEqual('http://localhost:3000');
143+
expect(toAbsoluteUrl('/user/repo')).toEqual('http://localhost:3000/user/repo');
144144
});

0 commit comments

Comments
 (0)