Commit 7cf25997 authored by Vladimir Shushlin's avatar Vladimir Shushlin

Add route and action for new releases form

parent 2f06dde1
......@@ -13,6 +13,7 @@ class Projects::ReleasesController < Projects::ApplicationController
push_frontend_feature_flag(:release_asset_link_type, project, default_enabled: true)
end
before_action :authorize_update_release!, only: %i[edit update]
before_action :authorize_create_release!, only: :new
def index
respond_to do |format|
......
- page_title s_('Releases|New Release')
......@@ -181,7 +181,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
resources :releases, only: [:index, :show, :edit], param: :tag, constraints: { tag: %r{[^/]+} } do
resources :releases, only: [:index, :new, :show, :edit], param: :tag, constraints: { tag: %r{[^/]+} } do
member do
get :downloads, path: 'downloads/*filepath', format: false
scope module: :releases do
......
......@@ -18749,6 +18749,9 @@ msgstr ""
msgid "Releases documentation"
msgstr ""
msgid "Releases|New Release"
msgstr ""
msgid "Release|Something went wrong while getting the release details"
msgstr ""
......
......@@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe Projects::ReleasesController do
include AccessMatchersForController
let!(:project) { create(:project, :repository, :public) }
let_it_be(:private_project) { create(:project, :repository, :private) }
let_it_be(:developer) { create(:user) }
......@@ -118,6 +120,15 @@ RSpec.describe Projects::ReleasesController do
end
end
describe 'GET #new' do
let(:request) do
get :new, params: { namespace_id: project.namespace, project_id: project }
end
it { expect { request }.to be_denied_for(:reporter).of(project) }
it { expect { request }.to be_allowed_for(:developer).of(project) }
end
describe 'GET #edit' do
subject do
get :edit, params: { namespace_id: project.namespace, project_id: project, tag: tag }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment