Commit 933a0b75 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'ajk-jira-connect-fix-ff-url' into 'master'

Fix the URL generation for feature flags

See merge request gitlab-org/gitlab!52221
parents 6aa2c9a4 9941cef6
---
title: Fix URL in JiraConnect feature flag serializer
merge_request: 52221
author:
type: fixed
...@@ -50,7 +50,7 @@ module Atlassian ...@@ -50,7 +50,7 @@ module Atlassian
# edit path as an interim solution. # edit path as an interim solution.
def summary(strategies = flag.strategies) def summary(strategies = flag.strategies)
{ {
url: project_url(flag.project) + "/-/feature_flags/#{flag.id}/edit", url: edit_project_feature_flag_url(flag.project, flag),
lastUpdated: flag.updated_at.iso8601, lastUpdated: flag.updated_at.iso8601,
status: { status: {
enabled: flag.active, enabled: flag.active,
......
...@@ -9,7 +9,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::FeatureFlagEntity do ...@@ -9,7 +9,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::FeatureFlagEntity do
subject { described_class.represent(feature_flag) } subject { described_class.represent(feature_flag) }
context 'when the feature flag does not belong to any Jira issue' do context 'when the feature flag does not belong to any Jira issue' do
let_it_be(:feature_flag) { create(:operations_feature_flag) } let_it_be(:feature_flag) { create(:operations_feature_flag, project: project) }
describe '#issue_keys' do describe '#issue_keys' do
it 'is empty' do it 'is empty' do
...@@ -30,7 +30,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::FeatureFlagEntity do ...@@ -30,7 +30,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::FeatureFlagEntity do
context 'when the feature flag does belong to a Jira issue' do context 'when the feature flag does belong to a Jira issue' do
let(:feature_flag) do let(:feature_flag) do
create(:operations_feature_flag, description: 'THING-123') create(:operations_feature_flag, project: project, description: 'THING-123')
end end
describe '#issue_keys' do describe '#issue_keys' do
...@@ -66,6 +66,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::FeatureFlagEntity do ...@@ -66,6 +66,7 @@ RSpec.describe Atlassian::JiraConnect::Serializers::FeatureFlagEntity do
end end
it 'has the correct summary' do it 'has the correct summary' do
expect(entity.dig('summary', 'url')).to eq "http://localhost/#{project.full_path}/-/feature_flags/#{feature_flag.iid}/edit"
expect(entity.dig('summary', 'status')).to eq( expect(entity.dig('summary', 'status')).to eq(
'enabled' => true, 'enabled' => true,
'defaultValue' => '', 'defaultValue' => '',
......
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