Merge branch 'gh-keep-issues-prs-references' into 'master'
Use GitHub Issue/PR number as iid to keep references Closes #15294 See merge request !3759
This commit is contained in:
commit
387b025d15
6 changed files with 14 additions and 4 deletions
|
@ -84,6 +84,7 @@ v 8.7.0 (unreleased)
|
||||||
- Author and participants are displayed first on users autocompletion
|
- Author and participants are displayed first on users autocompletion
|
||||||
- Show number sign on external issue reference text (Florent Baldino)
|
- Show number sign on external issue reference text (Florent Baldino)
|
||||||
- Updated print style for issues
|
- Updated print style for issues
|
||||||
|
- Use GitHub Issue/PR number as iid to keep references
|
||||||
|
|
||||||
v 8.6.6
|
v 8.6.6
|
||||||
- Expire the exists cache before deletion to ensure project dir actually exists (Stan Hu). !3413
|
- Expire the exists cache before deletion to ensure project dir actually exists (Stan Hu). !3413
|
||||||
|
|
|
@ -7,11 +7,13 @@ module InternalId
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_iid
|
def set_iid
|
||||||
records = project.send(self.class.name.tableize)
|
if iid.blank?
|
||||||
records = records.with_deleted if self.paranoid?
|
records = project.send(self.class.name.tableize)
|
||||||
max_iid = records.maximum(:iid)
|
records = records.with_deleted if self.paranoid?
|
||||||
|
max_iid = records.maximum(:iid)
|
||||||
|
|
||||||
self.iid = max_iid.to_i + 1
|
self.iid = max_iid.to_i + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
|
|
|
@ -3,6 +3,7 @@ module Gitlab
|
||||||
class IssueFormatter < BaseFormatter
|
class IssueFormatter < BaseFormatter
|
||||||
def attributes
|
def attributes
|
||||||
{
|
{
|
||||||
|
iid: number,
|
||||||
project: project,
|
project: project,
|
||||||
title: raw_data.title,
|
title: raw_data.title,
|
||||||
description: description,
|
description: description,
|
||||||
|
|
|
@ -3,6 +3,7 @@ module Gitlab
|
||||||
class PullRequestFormatter < BaseFormatter
|
class PullRequestFormatter < BaseFormatter
|
||||||
def attributes
|
def attributes
|
||||||
{
|
{
|
||||||
|
iid: number,
|
||||||
title: raw_data.title,
|
title: raw_data.title,
|
||||||
description: description,
|
description: description,
|
||||||
source_project: source_project,
|
source_project: source_project,
|
||||||
|
|
|
@ -30,6 +30,7 @@ describe Gitlab::GithubImport::IssueFormatter, lib: true do
|
||||||
|
|
||||||
it 'returns formatted attributes' do
|
it 'returns formatted attributes' do
|
||||||
expected = {
|
expected = {
|
||||||
|
iid: 1347,
|
||||||
project: project,
|
project: project,
|
||||||
title: 'Found a bug',
|
title: 'Found a bug',
|
||||||
description: "*Created by: octocat*\n\nI'm having a problem with this.",
|
description: "*Created by: octocat*\n\nI'm having a problem with this.",
|
||||||
|
@ -50,6 +51,7 @@ describe Gitlab::GithubImport::IssueFormatter, lib: true do
|
||||||
|
|
||||||
it 'returns formatted attributes' do
|
it 'returns formatted attributes' do
|
||||||
expected = {
|
expected = {
|
||||||
|
iid: 1347,
|
||||||
project: project,
|
project: project,
|
||||||
title: 'Found a bug',
|
title: 'Found a bug',
|
||||||
description: "*Created by: octocat*\n\nI'm having a problem with this.",
|
description: "*Created by: octocat*\n\nI'm having a problem with this.",
|
||||||
|
|
|
@ -35,6 +35,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
|
||||||
|
|
||||||
it 'returns formatted attributes' do
|
it 'returns formatted attributes' do
|
||||||
expected = {
|
expected = {
|
||||||
|
iid: 1347,
|
||||||
title: 'New feature',
|
title: 'New feature',
|
||||||
description: "*Created by: octocat*\n\nPlease pull these awesome changes",
|
description: "*Created by: octocat*\n\nPlease pull these awesome changes",
|
||||||
source_project: project,
|
source_project: project,
|
||||||
|
@ -58,6 +59,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
|
||||||
|
|
||||||
it 'returns formatted attributes' do
|
it 'returns formatted attributes' do
|
||||||
expected = {
|
expected = {
|
||||||
|
iid: 1347,
|
||||||
title: 'New feature',
|
title: 'New feature',
|
||||||
description: "*Created by: octocat*\n\nPlease pull these awesome changes",
|
description: "*Created by: octocat*\n\nPlease pull these awesome changes",
|
||||||
source_project: project,
|
source_project: project,
|
||||||
|
@ -81,6 +83,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
|
||||||
|
|
||||||
it 'returns formatted attributes' do
|
it 'returns formatted attributes' do
|
||||||
expected = {
|
expected = {
|
||||||
|
iid: 1347,
|
||||||
title: 'New feature',
|
title: 'New feature',
|
||||||
description: "*Created by: octocat*\n\nPlease pull these awesome changes",
|
description: "*Created by: octocat*\n\nPlease pull these awesome changes",
|
||||||
source_project: project,
|
source_project: project,
|
||||||
|
|
Loading…
Reference in a new issue