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
ac00009f
Commit
ac00009f
authored
Dec 08, 2016
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to delete tag release note
parent
10d4b20a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
1 deletion
+67
-1
app/controllers/projects/releases_controller.rb
app/controllers/projects/releases_controller.rb
+8
-1
changelogs/unreleased/issue_13270.yml
changelogs/unreleased/issue_13270.yml
+4
-0
spec/controllers/projects/releases_controller_spec.rb
spec/controllers/projects/releases_controller_spec.rb
+55
-0
No files found.
app/controllers/projects/releases_controller.rb
View file @
ac00009f
...
@@ -10,7 +10,14 @@ class Projects::ReleasesController < Projects::ApplicationController
...
@@ -10,7 +10,14 @@ class Projects::ReleasesController < Projects::ApplicationController
end
end
def
update
def
update
# Release belongs to Tag which is not active record object,
# it exists only to save a description to each Tag.
# If description is empty we should destroy the existing record.
if
release_params
[
:description
].
present?
release
.
update_attributes
(
release_params
)
release
.
update_attributes
(
release_params
)
else
release
.
destroy
end
redirect_to
namespace_project_tag_path
(
@project
.
namespace
,
@project
,
@tag
.
name
)
redirect_to
namespace_project_tag_path
(
@project
.
namespace
,
@project
,
@tag
.
name
)
end
end
...
...
changelogs/unreleased/issue_13270.yml
0 → 100644
View file @
ac00009f
---
title
:
Allow to delete tag release note
merge_request
:
author
:
spec/controllers/projects/releases_controller_spec.rb
0 → 100644
View file @
ac00009f
require
'spec_helper'
describe
Projects
::
ReleasesController
do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:release
)
{
create
(
:release
,
project:
project
)
}
let!
(
:tag
)
{
release
.
tag
}
before
do
project
.
team
<<
[
user
,
:developer
]
sign_in
(
user
)
end
describe
'GET #edit'
do
it
'initializes a new release'
do
tag_id
=
release
.
tag
project
.
releases
.
destroy_all
get
:edit
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
tag_id:
tag_id
release
=
assigns
(
:release
)
expect
(
release
).
not_to
be_nil
expect
(
release
).
not_to
be_persisted
end
it
'retrieves an existing release'
do
get
:edit
,
namespace_id:
project
.
namespace
.
path
,
project_id:
project
.
path
,
tag_id:
release
.
tag
release
=
assigns
(
:release
)
expect
(
release
).
not_to
be_nil
expect
(
release
).
to
be_persisted
end
end
describe
'PUT #update'
do
it
'updates release note description'
do
update_release
(
'description updated'
)
release
=
project
.
releases
.
find_by_tag
(
tag
)
expect
(
release
.
description
).
to
eq
(
"description updated"
)
end
it
'deletes release note when description is null'
do
expect
{
update_release
(
''
)
}.
to
change
(
project
.
releases
,
:count
).
by
(
-
1
)
end
end
def
update_release
(
description
)
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
tag_id:
release
.
tag
,
release:
{
description:
description
}
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