Commit d96abbee authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 69849c28
...@@ -317,11 +317,11 @@ module SystemNoteService ...@@ -317,11 +317,11 @@ module SystemNoteService
end end
def zoom_link_added(issue, project, author) def zoom_link_added(issue, project, author)
create_note(NoteSummary.new(issue, project, author, _('added a Zoom call to this issue'), action: 'pinned_embed')) ::SystemNotes::ZoomService.new(noteable: issue, project: project, author: author).zoom_link_added
end end
def zoom_link_removed(issue, project, author) def zoom_link_removed(issue, project, author)
create_note(NoteSummary.new(issue, project, author, _('removed a Zoom call from this issue'), action: 'pinned_embed')) ::SystemNotes::ZoomService.new(noteable: issue, project: project, author: author).zoom_link_removed
end end
private private
......
# frozen_string_literal: true
module SystemNotes
class ZoomService < ::SystemNotes::BaseService
def zoom_link_added
create_note(NoteSummary.new(noteable, project, author, _('added a Zoom call to this issue'), action: 'pinned_embed'))
end
def zoom_link_removed
create_note(NoteSummary.new(noteable, project, author, _('removed a Zoom call from this issue'), action: 'pinned_embed'))
end
end
end
---
title: 'GitHub import: Handle nil published_at dates'
merge_request: 18355
author:
type: fixed
...@@ -379,6 +379,8 @@ This functionality is only available: ...@@ -379,6 +379,8 @@ This functionality is only available:
## Most Recent Pipeline ## Most Recent Pipeline
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/50499) in GitLab 12.3.
There's a link to the latest pipeline for the last commit of a given branch at `/project/pipelines/[branch]/latest`. Also, `/project/pipelines/latest` will redirect you to the latest pipeline for the last commit on the project's default branch. There's a link to the latest pipeline for the last commit of a given branch at `/project/pipelines/[branch]/latest`. Also, `/project/pipelines/latest` will redirect you to the latest pipeline for the last commit on the project's default branch.
## Security on protected branches ## Security on protected branches
......
...@@ -215,17 +215,6 @@ Example response: ...@@ -215,17 +215,6 @@ Example response:
- GitLab Geo - GitLab Geo
- GitLab-shell's `bin/check` - GitLab-shell's `bin/check`
## Broadcast message(s) [NOT USED]
```
GET /internal/broadcast_message
GET /internal/broadcast_messages
```
**Deprecated:** This used to be used by GitLab-shell to print out broadcast
messages. But this is now included in the `post_receive` call. Other
clients can use the public BroadcastMessages API.
## Get new 2FA recovery codes using an SSH key ## Get new 2FA recovery codes using an SSH key
This is called from GitLab-shell and allows users to get new 2FA This is called from GitLab-shell and allows users to get new 2FA
......
...@@ -148,22 +148,6 @@ module API ...@@ -148,22 +148,6 @@ module API
} }
end end
get "/broadcast_messages" do
if messages = BroadcastMessage.current
present messages, with: Entities::BroadcastMessage
else
[]
end
end
get "/broadcast_message" do
if message = BroadcastMessage.current&.last
present message, with: Entities::BroadcastMessage
else
{}
end
end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
post '/two_factor_recovery_codes' do post '/two_factor_recovery_codes' do
status 200 status 200
......
...@@ -37,7 +37,8 @@ module Gitlab ...@@ -37,7 +37,8 @@ module Gitlab
description: description_for(release), description: description_for(release),
created_at: release.created_at, created_at: release.created_at,
updated_at: release.created_at, updated_at: release.created_at,
released_at: release.published_at, # Draft releases will have a null published_at
released_at: release.published_at || Time.current,
project_id: project.id project_id: project.id
} }
end end
......
...@@ -10,7 +10,8 @@ module Gitlab ...@@ -10,7 +10,8 @@ module Gitlab
name: raw_data.name, name: raw_data.name,
description: raw_data.body, description: raw_data.body,
created_at: raw_data.created_at, created_at: raw_data.created_at,
released_at: raw_data.published_at, # Draft releases will have a null published_at
released_at: raw_data.published_at || Time.current,
updated_at: raw_data.created_at updated_at: raw_data.created_at
} }
end end
......
...@@ -255,9 +255,9 @@ EOF ...@@ -255,9 +255,9 @@ EOF
} }
function display_deployment_debug() { function display_deployment_debug() {
# Get all pods that are not ready (this will return completed pods for minio and migrations jobs) # Get all pods for this release
echoinfo "Unready Pods for release ${CI_ENVIRONMENT_SLUG}" echoinfo "Pods for release ${CI_ENVIRONMENT_SLUG}"
kubectl get pods -n "$KUBE_NAMESPACE" -lrelease=${CI_ENVIRONMENT_SLUG} --field-selector=status.phase!=Running kubectl get pods -n "$KUBE_NAMESPACE" -lrelease=${CI_ENVIRONMENT_SLUG}
# Get all non-completed jobs # Get all non-completed jobs
echoinfo "Unsuccessful Jobs for release ${CI_ENVIRONMENT_SLUG}" echoinfo "Unsuccessful Jobs for release ${CI_ENVIRONMENT_SLUG}"
......
...@@ -34,6 +34,22 @@ describe Gitlab::GithubImport::Importer::ReleasesImporter do ...@@ -34,6 +34,22 @@ describe Gitlab::GithubImport::Importer::ReleasesImporter do
importer.execute importer.execute
end end
it 'imports draft releases' do
release_double = double(
name: 'Test',
body: 'This is description',
tag_name: '1.0',
description: 'This is my release',
created_at: created_at,
updated_at: created_at,
published_at: nil
)
expect(importer).to receive(:each_release).and_return([release_double])
expect { importer.execute }.to change { Release.count }.by(1)
end
end end
describe '#build_releases' do describe '#build_releases' do
......
...@@ -37,6 +37,14 @@ describe Gitlab::LegacyGithubImport::ReleaseFormatter do ...@@ -37,6 +37,14 @@ describe Gitlab::LegacyGithubImport::ReleaseFormatter do
expect(release.attributes).to eq(expected) expect(release.attributes).to eq(expected)
end end
context 'with a nil published_at date' do
let(:published_at) { nil }
it 'inserts a timestamp for released_at' do
expect(release.attributes[:released_at]).to be_a(Time)
end
end
end end
describe '#valid' do describe '#valid' do
......
...@@ -43,61 +43,6 @@ describe API::Internal::Base do ...@@ -43,61 +43,6 @@ describe API::Internal::Base do
end end
end end
describe 'GET /internal/broadcast_message' do
context 'broadcast message exists' do
let!(:broadcast_message) { create(:broadcast_message, starts_at: 1.day.ago, ends_at: 1.day.from_now ) }
it 'returns one broadcast message' do
get api('/internal/broadcast_message'), params: { secret_token: secret_token }
expect(response).to have_gitlab_http_status(200)
expect(json_response['message']).to eq(broadcast_message.message)
end
end
context 'broadcast message does not exist' do
it 'returns nothing' do
get api('/internal/broadcast_message'), params: { secret_token: secret_token }
expect(response).to have_gitlab_http_status(200)
expect(json_response).to be_empty
end
end
context 'nil broadcast message' do
it 'returns nothing' do
allow(BroadcastMessage).to receive(:current).and_return(nil)
get api('/internal/broadcast_message'), params: { secret_token: secret_token }
expect(response).to have_gitlab_http_status(200)
expect(json_response).to be_empty
end
end
end
describe 'GET /internal/broadcast_messages' do
context 'broadcast message(s) exist' do
let!(:broadcast_message) { create(:broadcast_message, starts_at: 1.day.ago, ends_at: 1.day.from_now ) }
it 'returns active broadcast message(s)' do
get api('/internal/broadcast_messages'), params: { secret_token: secret_token }
expect(response).to have_gitlab_http_status(200)
expect(json_response[0]['message']).to eq(broadcast_message.message)
end
end
context 'broadcast message does not exist' do
it 'returns nothing' do
get api('/internal/broadcast_messages'), params: { secret_token: secret_token }
expect(response).to have_gitlab_http_status(200)
expect(json_response).to be_empty
end
end
end
describe 'GET /internal/two_factor_recovery_codes' do describe 'GET /internal/two_factor_recovery_codes' do
it 'returns an error message when the key does not exist' do it 'returns an error message when the key does not exist' do
post api('/internal/two_factor_recovery_codes'), post api('/internal/two_factor_recovery_codes'),
......
...@@ -271,26 +271,22 @@ describe SystemNoteService do ...@@ -271,26 +271,22 @@ describe SystemNoteService do
end end
describe '.zoom_link_added' do describe '.zoom_link_added' do
subject { described_class.zoom_link_added(issue, project, author) } it 'calls ZoomService' do
expect_next_instance_of(::SystemNotes::ZoomService) do |service|
it_behaves_like 'a system note' do expect(service).to receive(:zoom_link_added)
let(:action) { 'pinned_embed' }
end end
it 'sets the zoom link added note text' do described_class.zoom_link_added(noteable, project, author)
expect(subject.note).to eq('added a Zoom call to this issue')
end end
end end
describe '.zoom_link_removed' do describe '.zoom_link_removed' do
subject { described_class.zoom_link_removed(issue, project, author) } it 'calls ZoomService' do
expect_next_instance_of(::SystemNotes::ZoomService) do |service|
it_behaves_like 'a system note' do expect(service).to receive(:zoom_link_removed)
let(:action) { 'pinned_embed' }
end end
it 'sets the zoom link removed note text' do described_class.zoom_link_removed(noteable, project, author)
expect(subject.note).to eq('removed a Zoom call from this issue')
end end
end end
......
# frozen_string_literal: true
require 'spec_helper'
describe ::SystemNotes::ZoomService do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:author) { create(:user) }
let(:noteable) { create(:issue, project: project) }
let(:service) { described_class.new(noteable: noteable, project: project, author: author) }
describe '#zoom_link_added' do
subject { service.zoom_link_added }
it_behaves_like 'a system note' do
let(:action) { 'pinned_embed' }
end
it 'sets the zoom link added note text' do
expect(subject.note).to eq('added a Zoom call to this issue')
end
end
describe '#zoom_link_removed' do
subject { service.zoom_link_removed }
it_behaves_like 'a system note' do
let(:action) { 'pinned_embed' }
end
it 'sets the zoom link removed note text' do
expect(subject.note).to eq('removed a Zoom call from this issue')
end
end
end
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