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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
19e15ae2
Commit
19e15ae2
authored
Jul 06, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a more future-proof check for Note/LegacyDiffNote
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
4834e2e6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
app/models/event.rb
app/models/event.rb
+1
-1
spec/models/event_spec.rb
spec/models/event_spec.rb
+4
-4
No files found.
app/models/event.rb
View file @
19e15ae2
...
...
@@ -136,7 +136,7 @@ class Event < ActiveRecord::Base
end
def
note?
%w[Note LegacyDiffNote]
.
include?
(
target_typ
e
)
target
.
is_a?
(
Not
e
)
end
def
issue?
...
...
spec/models/event_spec.rb
View file @
19e15ae2
...
...
@@ -55,8 +55,8 @@ describe Event, models: true do
it
{
is_expected
.
to
be_note
}
end
context
'merge request note event'
do
let
(
:target
)
{
create
(
:note_on_merge_request
)
}
context
'merge request
diff
note event'
do
let
(
:target
)
{
create
(
:note_on_merge_request
_diff
)
}
it
{
is_expected
.
to
be_note
}
end
...
...
@@ -129,10 +129,10 @@ describe Event, models: true do
end
end
context
'merge request note event'
do
context
'merge request
diff
note event'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
author:
author
,
assignee:
assignee
)
}
let
(
:note_on_merge_request
)
{
create
(
:note_on_merge_request
,
noteable:
merge_request
,
project:
project
)
}
let
(
:note_on_merge_request
)
{
create
(
:note_on_merge_request
_diff
,
noteable:
merge_request
,
project:
project
)
}
let
(
:target
)
{
note_on_merge_request
}
it
{
expect
(
event
.
visible_to_user?
(
non_member
)).
to
eq
true
}
...
...
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