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
70b926e0
Commit
70b926e0
authored
May 10, 2017
by
Jarka Kadlecova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cross referencing for private and internal projects
parent
667005d5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
6 deletions
+88
-6
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+7
-6
changelogs/unreleased/31978-cross-reference-fix.yml
changelogs/unreleased/31978-cross-reference-fix.yml
+4
-0
spec/features/issues/notes_on_issues_spec.rb
spec/features/issues/notes_on_issues_spec.rb
+77
-0
No files found.
app/models/concerns/mentionable.rb
View file @
70b926e0
...
...
@@ -44,14 +44,15 @@ module Mentionable
end
def
all_references
(
current_user
=
nil
,
extractor:
nil
)
@extractors
||=
{}
# Use custom extractor if it's passed in the function parameters.
if
extractor
@extractor
=
extractor
@extractor
s
[
current_user
]
=
extractor
else
@extractor
||=
Gitlab
::
ReferenceExtractor
.
new
(
project
,
current_user
)
extractor
=
@extractors
[
current_user
]
||=
Gitlab
::
ReferenceExtractor
.
new
(
project
,
current_user
)
@
extractor
.
reset_memoized_values
extractor
.
reset_memoized_values
end
self
.
class
.
mentionable_attrs
.
each
do
|
attr
,
options
|
...
...
@@ -62,10 +63,10 @@ module Mentionable
skip_project_check:
skip_project_check?
)
@
extractor
.
analyze
(
text
,
options
)
extractor
.
analyze
(
text
,
options
)
end
@
extractor
extractor
end
def
mentioned_users
(
current_user
=
nil
)
...
...
changelogs/unreleased/31978-cross-reference-fix.yml
0 → 100644
View file @
70b926e0
---
title
:
Fix cross referencing for private and internal projects
merge_request
:
11243
author
:
spec/features/issues/notes_on_issues_spec.rb
0 → 100644
View file @
70b926e0
require
'spec_helper'
describe
'Create notes on issues'
,
:js
,
:feature
do
let
(
:user
)
{
create
(
:user
)
}
shared_examples
'notes with reference'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:note_text
)
{
"Check
#{
mention
.
to_reference
}
"
}
before
do
project
.
team
<<
[
user
,
:developer
]
login_as
(
user
)
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
fill_in
'note[note]'
,
with:
note_text
click_button
'Comment'
wait_for_ajax
end
it
'creates a note with reference and cross references the issue'
do
page
.
within
(
'div#notes li.note div.note-text'
)
do
expect
(
page
).
to
have_content
(
note_text
)
expect
(
page
.
find
(
'a'
)).
to
have_content
(
mention
.
to_reference
)
end
find
(
'div#notes li.note div.note-text a'
).
click
page
.
within
(
'div#notes li.note .system-note-message'
)
do
expect
(
page
).
to
have_content
(
'mentioned in issue'
)
expect
(
page
.
find
(
'a'
)).
to
have_content
(
issue
.
to_reference
)
end
end
end
context
'mentioning issue on a private project'
do
it_behaves_like
'notes with reference'
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
let
(
:mention
)
{
create
(
:issue
,
project:
project
)
}
end
end
context
'mentioning issue on an internal project'
do
it_behaves_like
'notes with reference'
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:mention
)
{
create
(
:issue
,
project:
project
)
}
end
end
context
'mentioning issue on a public project'
do
it_behaves_like
'notes with reference'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:mention
)
{
create
(
:issue
,
project:
project
)
}
end
end
context
'mentioning merge request on a private project'
do
it_behaves_like
'notes with reference'
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
let
(
:mention
)
{
create
(
:merge_request
,
source_project:
project
)
}
end
end
context
'mentioning merge request on an internal project'
do
it_behaves_like
'notes with reference'
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:mention
)
{
create
(
:merge_request
,
source_project:
project
)
}
end
end
context
'mentioning merge request on a public project'
do
it_behaves_like
'notes with reference'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:mention
)
{
create
(
:merge_request
,
source_project:
project
)
}
end
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