Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c6707291
Commit
c6707291
authored
May 23, 2019
by
Luke Picciau
Committed by
Sean McGivern
May 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change system notes to use relative urls
parent
b02c2583
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
8 deletions
+13
-8
app/services/system_note_service.rb
app/services/system_note_service.rb
+6
-6
changelogs/unreleased/relative-urls-for-system-notes.yml
changelogs/unreleased/relative-urls-for-system-notes.yml
+5
-0
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+2
-2
No files found.
app/services/system_note_service.rb
View file @
c6707291
...
...
@@ -25,7 +25,7 @@ module SystemNoteService
text_parts
=
[
"added
#{
commits_text
}
"
]
text_parts
<<
commits_list
(
noteable
,
new_commits
,
existing_commits
,
oldrev
)
text_parts
<<
"[Compare with previous version](
#{
diff_comparison_
url
(
noteable
,
project
,
oldrev
)
}
)"
text_parts
<<
"[Compare with previous version](
#{
diff_comparison_
path
(
noteable
,
project
,
oldrev
)
}
)"
body
=
text_parts
.
join
(
"
\n\n
"
)
...
...
@@ -41,7 +41,7 @@ module SystemNoteService
#
# Returns the created Note object
def
tag_commit
(
noteable
,
project
,
author
,
tag_name
)
link
=
url_helpers
.
project_tag_
url
(
project
,
id:
tag_name
)
link
=
url_helpers
.
project_tag_
path
(
project
,
id:
tag_name
)
body
=
"tagged commit
#{
noteable
.
sha
}
to [`
#{
tag_name
}
`](
#{
link
}
)"
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'tag'
))
...
...
@@ -272,7 +272,7 @@ module SystemNoteService
text_parts
=
[
"changed this line in"
]
if
version_params
=
merge_request
.
version_params_for
(
diff_refs
)
line_code
=
change_position
.
line_code
(
project
.
repository
)
url
=
url_helpers
.
diffs_project_merge_request_
url
(
project
,
merge_request
,
version_params
.
merge
(
anchor:
line_code
))
url
=
url_helpers
.
diffs_project_merge_request_
path
(
project
,
merge_request
,
version_params
.
merge
(
anchor:
line_code
))
text_parts
<<
"[version
#{
version_index
}
of the diff](
#{
url
}
)"
else
...
...
@@ -405,7 +405,7 @@ module SystemNoteService
#
# "created branch `201-issue-branch-button`"
def
new_issue_branch
(
issue
,
project
,
author
,
branch
)
link
=
url_helpers
.
project_compare_
url
(
project
,
from:
project
.
default_branch
,
to:
branch
)
link
=
url_helpers
.
project_compare_
path
(
project
,
from:
project
.
default_branch
,
to:
branch
)
body
=
"created branch [`
#{
branch
}
`](
#{
link
}
) to address this issue"
...
...
@@ -668,10 +668,10 @@ module SystemNoteService
@url_helpers
||=
Gitlab
::
Routing
.
url_helpers
end
def
diff_comparison_
url
(
merge_request
,
project
,
oldrev
)
def
diff_comparison_
path
(
merge_request
,
project
,
oldrev
)
diff_id
=
merge_request
.
merge_request_diff
.
id
url_helpers
.
diffs_project_merge_request_
url
(
url_helpers
.
diffs_project_merge_request_
path
(
project
,
merge_request
,
diff_id:
diff_id
,
...
...
changelogs/unreleased/relative-urls-for-system-notes.yml
0 → 100644
View file @
c6707291
---
title
:
Change links in system notes to use relative paths
merge_request
:
28588
author
:
Luke Picciau
type
:
fixed
spec/services/system_note_service_spec.rb
View file @
c6707291
...
...
@@ -132,7 +132,7 @@ describe SystemNoteService do
end
it
'sets the note text'
do
link
=
"
http://localhost
/
#{
project
.
full_path
}
/-/tags/
#{
tag_name
}
"
link
=
"/
#{
project
.
full_path
}
/-/tags/
#{
tag_name
}
"
expect
(
subject
.
note
).
to
eq
"tagged commit
#{
noteable
.
sha
}
to [`
#{
tag_name
}
`](
#{
link
}
)"
end
...
...
@@ -1139,7 +1139,7 @@ describe SystemNoteService do
diff_id
=
merge_request
.
merge_request_diff
.
id
line_code
=
change_position
.
line_code
(
project
.
repository
)
expect
(
subject
.
note
).
to
include
(
diffs_project_merge_request_
url
(
project
,
merge_request
,
diff_id:
diff_id
,
anchor:
line_code
))
expect
(
subject
.
note
).
to
include
(
diffs_project_merge_request_
path
(
project
,
merge_request
,
diff_id:
diff_id
,
anchor:
line_code
))
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment