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
31f121f0
Commit
31f121f0
authored
Jan 21, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
be12ee33
c141d0af
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
29 deletions
+24
-29
app/models/issue.rb
app/models/issue.rb
+2
-1
changelogs/unreleased/56371-don-t-check-confidential-issues-for-spam.yml
...leased/56371-don-t-check-confidential-issues-for-spam.yml
+5
-0
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+17
-28
No files found.
app/models/issue.rb
View file @
31f121f0
...
...
@@ -230,7 +230,8 @@ class Issue < ActiveRecord::Base
end
def
check_for_spam?
project
.
public?
&&
(
title_changed?
||
description_changed?
)
publicly_visible?
&&
(
title_changed?
||
description_changed?
||
confidential_changed?
)
end
def
as_json
(
options
=
{})
...
...
changelogs/unreleased/56371-don-t-check-confidential-issues-for-spam.yml
0 → 100644
View file @
31f121f0
---
title
:
Do not run spam checks on confidential issues
merge_request
:
24453
author
:
type
:
fixed
spec/models/issue_spec.rb
View file @
31f121f0
...
...
@@ -721,39 +721,28 @@ describe Issue do
end
end
describe
'#check_for_spam'
do
let
(
:project
)
{
create
:project
,
visibility_level:
visibility_level
}
let
(
:issue
)
{
create
:issue
,
project:
project
}
describe
'#check_for_spam?'
do
using
RSpec
::
Parameterized
::
TableSyntax
subject
do
issue
.
assign_attributes
(
description:
description
)
issue
.
check_for_spam?
where
(
:visibility_level
,
:confidential
,
:new_attributes
,
:check_for_spam?
)
do
Gitlab
::
VisibilityLevel
::
PUBLIC
|
false
|
{
description:
'woo'
}
|
true
Gitlab
::
VisibilityLevel
::
PUBLIC
|
false
|
{
title:
'woo'
}
|
true
Gitlab
::
VisibilityLevel
::
PUBLIC
|
true
|
{
confidential:
false
}
|
true
Gitlab
::
VisibilityLevel
::
PUBLIC
|
true
|
{
description:
'woo'
}
|
false
Gitlab
::
VisibilityLevel
::
PUBLIC
|
false
|
{
title:
'woo'
,
confidential:
true
}
|
false
Gitlab
::
VisibilityLevel
::
PUBLIC
|
false
|
{
description:
'original description'
}
|
false
Gitlab
::
VisibilityLevel
::
INTERNAL
|
false
|
{
description:
'woo'
}
|
false
Gitlab
::
VisibilityLevel
::
PRIVATE
|
false
|
{
description:
'woo'
}
|
false
end
context
'when project is public and spammable attributes changed'
do
let
(
:visibility_level
)
{
Gitlab
::
VisibilityLevel
::
PUBLIC
}
let
(
:description
)
{
'woo'
}
with_them
do
it
'checks for spam on issues that can be seen anonymously'
do
project
=
create
(
:project
,
visibility_level:
visibility_level
)
issue
=
create
(
:issue
,
project:
project
,
confidential:
confidential
,
description:
'original description'
)
it
'returns true'
do
is_expected
.
to
be_truthy
end
end
context
'when project is private'
do
let
(
:visibility_level
)
{
Gitlab
::
VisibilityLevel
::
PRIVATE
}
let
(
:description
)
{
issue
.
description
}
it
'returns false'
do
is_expected
.
to
be_falsey
end
end
context
'when spammable attributes have not changed'
do
let
(
:visibility_level
)
{
Gitlab
::
VisibilityLevel
::
PUBLIC
}
let
(
:description
)
{
issue
.
description
}
issue
.
assign_attributes
(
new_attributes
)
it
'returns false'
do
is_expected
.
to
be_falsey
expect
(
issue
.
check_for_spam?
).
to
eq
(
check_for_spam?
)
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