2018-11-17 00:37:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-04-18 16:44:27 +00:00
|
|
|
module Gitlab
|
2017-10-13 16:50:36 +00:00
|
|
|
module LegacyGithubImport
|
2016-04-18 16:44:27 +00:00
|
|
|
class MilestoneFormatter < BaseFormatter
|
|
|
|
def attributes
|
|
|
|
{
|
2016-12-15 16:36:53 +00:00
|
|
|
iid: number,
|
2016-04-18 16:44:27 +00:00
|
|
|
project: project,
|
2016-08-30 19:20:56 +00:00
|
|
|
title: raw_data.title,
|
|
|
|
description: raw_data.description,
|
|
|
|
due_date: raw_data.due_on,
|
2016-04-18 16:44:27 +00:00
|
|
|
state: state,
|
2016-08-30 19:20:56 +00:00
|
|
|
created_at: raw_data.created_at,
|
|
|
|
updated_at: raw_data.updated_at
|
2016-04-18 16:44:27 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2016-10-19 18:42:31 +00:00
|
|
|
def project_association
|
|
|
|
:milestones
|
|
|
|
end
|
|
|
|
|
|
|
|
def find_condition
|
2016-12-15 16:36:53 +00:00
|
|
|
{ iid: number }
|
2016-10-17 15:58:57 +00:00
|
|
|
end
|
|
|
|
|
2016-12-15 16:36:53 +00:00
|
|
|
def number
|
2016-12-16 16:44:22 +00:00
|
|
|
if project.gitea_import?
|
2016-12-15 16:36:53 +00:00
|
|
|
raw_data.id
|
|
|
|
else
|
|
|
|
raw_data.number
|
|
|
|
end
|
2016-05-18 21:14:20 +00:00
|
|
|
end
|
|
|
|
|
2016-04-18 16:44:27 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def state
|
|
|
|
raw_data.state == 'closed' ? 'closed' : 'active'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|