BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
b40941db
Commit
b40941db
authored
Sep 05, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix note resolution specs
parent
007b325d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
10 deletions
+16
-10
resolvable_note.rb
app/models/concerns/resolvable_note.rb
+6
-2
safe_model_attributes.yml
spec/lib/gitlab/import_export/safe_model_attributes.yml
+2
-0
resolvable_note_spec.rb
spec/models/concerns/resolvable_note_spec.rb
+8
-8
No files found.
app/models/concerns/resolvable_note.rb
View file @
b40941db
...
...
@@ -58,15 +58,19 @@ module ResolvableNote
self
.
resolved_at
=
Time
.
now
self
.
resolved_by
=
current_user
self
.
resolved_by_push
=
resolved_by_push
true
end
# If you update this method remember to also update `.unresolve!`
def
unresolve_without_save
(
current_user
)
def
unresolve_without_save
return
false
unless
resolvable?
return
false
unless
resolved?
self
.
resolved_at
=
nil
self
.
resolved_by
=
nil
true
end
def
resolve!
(
current_user
,
resolved_by_push:
false
)
...
...
@@ -75,6 +79,6 @@ module ResolvableNote
end
def
unresolve!
unresolve_without_save
(
current_user
)
&&
save
unresolve_without_save
&&
save!
end
end
spec/lib/gitlab/import_export/safe_model_attributes.yml
View file @
b40941db
...
...
@@ -65,6 +65,7 @@ Note:
-
change_position
-
resolved_at
-
resolved_by_id
-
resolved_by_push
-
discussion_id
-
original_discussion_id
LabelLink
:
...
...
@@ -407,6 +408,7 @@ Project:
-
only_allow_merge_if_all_discussions_are_resolved
-
auto_cancel_pending_pipelines
-
printing_merge_request_link_enabled
-
resolve_outdated_diff_discussions
-
build_allow_git_fetch
-
last_repository_updated_at
-
ci_config_path
...
...
spec/models/concerns/resolvable_note_spec.rb
View file @
b40941db
...
...
@@ -189,8 +189,8 @@ describe Note, ResolvableNote do
allow
(
subject
).
to
receive
(
:resolvable?
).
and_return
(
false
)
end
it
"returns
nil
"
do
expect
(
subject
.
resolve!
(
current_user
)).
to
be_
nil
it
"returns
false
"
do
expect
(
subject
.
resolve!
(
current_user
)).
to
be_
falsey
end
it
"doesn't set resolved_at"
do
...
...
@@ -224,8 +224,8 @@ describe Note, ResolvableNote do
subject
.
resolve!
(
user
)
end
it
"returns
nil
"
do
expect
(
subject
.
resolve!
(
current_user
)).
to
be_
nil
it
"returns
false
"
do
expect
(
subject
.
resolve!
(
current_user
)).
to
be_
falsey
end
it
"doesn't change resolved_at"
do
...
...
@@ -279,8 +279,8 @@ describe Note, ResolvableNote do
allow
(
subject
).
to
receive
(
:resolvable?
).
and_return
(
false
)
end
it
"returns
nil
"
do
expect
(
subject
.
unresolve!
).
to
be_
nil
it
"returns
false
"
do
expect
(
subject
.
unresolve!
).
to
be_
falsey
end
end
...
...
@@ -320,8 +320,8 @@ describe Note, ResolvableNote do
end
context
"when not resolved"
do
it
"returns
nil
"
do
expect
(
subject
.
unresolve!
).
to
be_
nil
it
"returns
false
"
do
expect
(
subject
.
unresolve!
).
to
be_
falsey
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