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
94764057
Commit
94764057
authored
Feb 24, 2022
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop system notes filter and use basic scope
parent
fcea425c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
26 deletions
+10
-26
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+2
-9
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+8
-17
No files found.
app/models/concerns/issuable.rb
View file @
94764057
...
@@ -73,15 +73,8 @@ module Issuable
...
@@ -73,15 +73,8 @@ module Issuable
end
end
end
end
has_many
:note_authors
,
->
{
distinct
},
through: :notes
,
source: :author
do
has_many
:note_authors
,
->
{
distinct
},
through: :notes
,
source: :author
def
user_notes
has_many
:user_note_authors
,
->
{
distinct
.
where
(
"notes.system = false"
)
},
through: :notes
,
source: :author
where
(
"notes.system = false"
)
end
def
system_notes
where
(
"notes.system = true"
)
end
end
has_many
:label_links
,
as: :target
,
inverse_of: :target
has_many
:label_links
,
as: :target
,
inverse_of: :target
has_many
:labels
,
through: :label_links
has_many
:labels
,
through: :label_links
...
...
spec/models/concerns/issuable_spec.rb
View file @
94764057
...
@@ -29,29 +29,20 @@ RSpec.describe Issuable do
...
@@ -29,29 +29,20 @@ RSpec.describe Issuable do
end
end
describe
'note_authors'
do
describe
'note_authors'
do
it
{
is_expected
.
to
have_many
(
:note_authors
).
through
(
:notes
)
}
end
describe
'user_note_authors'
do
let
(
:system_user
)
{
create
(
:user
)
}
let
(
:system_user
)
{
create
(
:user
)
}
let!
(
:system_note
)
{
create
(
:system_note
,
author:
system_user
,
noteable:
issue
,
project:
issue
.
project
)
}
let!
(
:system_note
)
{
create
(
:system_note
,
author:
system_user
,
noteable:
issue
,
project:
issue
.
project
)
}
it
{
is_expected
.
to
have_many
(
:note_authors
).
through
(
:notes
)
}
describe
'note_authors.user_notes'
do
it
'filters the authors to those of user notes'
do
it
'filters the authors to those of user notes'
do
authors
=
issue
.
note_authors
.
user_note
s
authors
=
issue
.
user_note_author
s
expect
(
authors
).
to
include
(
note
.
author
)
expect
(
authors
).
to
include
(
note
.
author
)
expect
(
authors
).
not_to
include
(
system_user
)
expect
(
authors
).
not_to
include
(
system_user
)
end
end
end
end
describe
'note_authors.system_notes'
do
it
'filters the authors to those of system notes'
do
authors
=
issue
.
note_authors
.
system_notes
expect
(
authors
).
to
include
(
system_user
)
expect
(
authors
).
not_to
include
(
note
.
author
)
end
end
end
end
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