Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-06-28 06:09:30 +00:00
parent f72c02a9a5
commit 8b7a679616
7 changed files with 49 additions and 7 deletions

View File

@ -4,7 +4,7 @@ class Admin::TopicsController < Admin::ApplicationController
include SendFileUpload
include PreviewMarkdown
before_action :topic, only: [:edit, :update]
before_action :topic, only: [:edit, :update, :destroy]
feature_category :projects
@ -37,6 +37,14 @@ class Admin::TopicsController < Admin::ApplicationController
end
end
def destroy
@topic.destroy!
redirect_to admin_topics_path,
status: :found,
notice: _('Topic %{topic_name} was successfully removed.') % { topic_name: @topic.title_or_name }
end
private
def topic

View File

@ -18,3 +18,4 @@
.controls.gl-flex-shrink-0.gl-ml-5
= link_to _('Edit'), edit_admin_topic_path(topic), id: "edit_#{dom_id(topic)}", class: 'btn gl-button btn-default'
= link_to _('Remove'), admin_topic_path(topic), aria: { label: _('Remove') }, data: { confirm: _("Are you sure you want to remove %{topic_name}?") % { topic_name: title }, confirm_btn_variant: 'danger' }, method: :delete, class: 'gl-button btn btn-danger'

View File

@ -1,12 +1,10 @@
%tr
%td{ colspan: 2, style: "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; color: #333333; font-size: 14px; font-weight: 400; line-height: 1.4; padding: 0 8px 16px; text-align: center;" }
had
= failed.size
failed
#{'job'.pluralize(failed.size)}.
= n_('had %{count} failed job', 'had %{count} failed jobs', failed.size).html_safe % { count: failed.size }
%tr.table-warning
%td{ style: "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; border: 1px solid #ededed; border-bottom: 0; border-radius: 4px 4px 0 0; overflow: hidden; background-color: #fdf4f6; color: #d22852; font-size: 14px; line-height: 1.4; text-align: center; padding: 8px 16px;" }
Failed jobs
_('Failed jobs')
%tr.section
%td{ style: "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; padding: 0 16px; border: 1px solid #ededed; border-radius: 4px; overflow: hidden; border-top: 0; border-radius: 0 0 4px 4px;" }
%table.builds{ border: "0", cellpadding: "0", cellspacing: "0", style: "width: 100%; border-collapse: collapse;" }

View File

@ -61,7 +61,7 @@ namespace :admin do
end
end
resources :topics, only: [:index, :new, :create, :edit, :update] do
resources :topics, only: [:index, :new, :create, :edit, :update, :destroy] do
resource :avatar, controller: 'topics/avatars', only: [:destroy]
collection do
post :preview_markdown

View File

@ -270,6 +270,8 @@ To create a new topic, select **New topic**.
To edit a topic, select **Edit** in that topic's row.
To remove a topic, select **Remove** in that topic's row.
To search for topics by name, enter your criteria in the search box. The topic search is case
insensitive and applies partial matching.

View File

@ -4965,6 +4965,9 @@ msgstr ""
msgid "Are you sure you want to remove %{group_name}?"
msgstr ""
msgid "Are you sure you want to remove %{topic_name}?"
msgstr ""
msgid "Are you sure you want to remove the attachment?"
msgstr ""
@ -40272,6 +40275,9 @@ msgstr ""
msgid "Topic %{topic_name} was successfully created."
msgstr ""
msgid "Topic %{topic_name} was successfully removed."
msgstr ""
msgid "Topic avatar"
msgstr ""
@ -45458,6 +45464,11 @@ msgstr ""
msgid "groups only"
msgstr ""
msgid "had %{count} failed job"
msgid_plural "had %{count} failed jobs"
msgstr[0] ""
msgstr[1] ""
msgid "has already been linked to another vulnerability"
msgstr ""

View File

@ -151,4 +151,26 @@ RSpec.describe Admin::TopicsController do
end
end
end
describe 'DELETE #destroy' do
it 'removes topic' do
delete :destroy, params: { id: topic.id }
expect(response).to redirect_to(admin_topics_path)
expect { topic.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
context 'as a normal user' do
before do
sign_in(user)
end
it 'renders a 404 error' do
delete :destroy, params: { id: topic.id }
expect(response).to have_gitlab_http_status(:not_found)
expect { topic.reload }.not_to raise_error
end
end
end
end