Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
3d2a7366
Commit
3d2a7366
authored
Jun 29, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing events for import/export
parent
9e8fdead
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
7 deletions
+34
-7
app/models/concerns/eventable.rb
app/models/concerns/eventable.rb
+15
-0
app/models/issue.rb
app/models/issue.rb
+1
-0
app/models/merge_request.rb
app/models/merge_request.rb
+1
-0
app/models/milestone.rb
app/models/milestone.rb
+1
-0
app/models/note.rb
app/models/note.rb
+1
-0
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+10
-5
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+5
-2
No files found.
app/models/concerns/eventable.rb
0 → 100644
View file @
3d2a7366
module
Eventable
extend
ActiveSupport
::
Concern
def
events
Event
.
where
(
target_id:
id
,
target_type:
self
.
class
.
to_s
)
end
def
events
=
(
events
)
events
.
each
do
|
event
|
event
.
target_id
=
id
event
.
data
.
deep_symbolize_keys!
event
.
save!
end
end
end
\ No newline at end of file
app/models/issue.rb
View file @
3d2a7366
...
...
@@ -6,6 +6,7 @@ class Issue < ActiveRecord::Base
include
Referable
include
Sortable
include
Taskable
include
Eventable
DueDateStruct
=
Struct
.
new
(
:title
,
:name
).
freeze
NoDueDate
=
DueDateStruct
.
new
(
'No Due Date'
,
'0'
).
freeze
...
...
app/models/merge_request.rb
View file @
3d2a7366
...
...
@@ -5,6 +5,7 @@ class MergeRequest < ActiveRecord::Base
include
Sortable
include
Taskable
include
Importable
include
Eventable
belongs_to
:target_project
,
foreign_key: :target_project_id
,
class_name:
"Project"
belongs_to
:source_project
,
foreign_key: :source_project_id
,
class_name:
"Project"
...
...
app/models/milestone.rb
View file @
3d2a7366
...
...
@@ -11,6 +11,7 @@ class Milestone < ActiveRecord::Base
include
Referable
include
StripAttribute
include
Milestoneish
include
Eventable
belongs_to
:project
has_many
:issues
...
...
app/models/note.rb
View file @
3d2a7366
...
...
@@ -5,6 +5,7 @@ class Note < ActiveRecord::Base
include
Mentionable
include
Awardable
include
Importable
include
Eventable
# Attribute containing rendered and redacted Markdown as generated by
# Banzai::ObjectRenderer.
...
...
lib/gitlab/import_export/import_export.yml
View file @
3d2a7366
# Model relationships to be included in the project import/export
project_tree
:
-
issues
:
-
:events
-
notes
:
:author
-
:author
-
:events
-
:labels
-
:milestones
-
milestones
:
-
:events
-
snippets
:
-
notes
:
:author
-
:releases
-
:events
-
project_members
:
-
:user
-
merge_requests
:
-
notes
:
:author
-
:author
-
:events
-
:merge_request_diff
-
:events
-
pipelines
:
-
notes
:
:author
-
:author
-
:events
-
:statuses
-
:variables
-
:triggers
...
...
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
View file @
3d2a7366
...
...
@@ -34,7 +34,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
end
it
'has events'
do
expect
(
saved_project_json
[
'events'
]).
not_to
be_empty
expect
(
saved_project_json
[
'
milestones'
].
first
[
'
events'
]).
not_to
be_empty
end
it
'has milestones'
do
...
...
@@ -132,7 +132,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
statuses:
[
commit_status
])
create
(
:ci_build
,
pipeline:
ci_pipeline
,
project:
project
)
create
(
:milestone
,
project:
project
)
milestone
=
create
(
:milestone
,
project:
project
)
create
(
:note
,
noteable:
issue
,
project:
project
)
create
(
:note
,
noteable:
merge_request
,
project:
project
)
create
(
:note
,
noteable:
snippet
,
project:
project
)
...
...
@@ -140,6 +140,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
author:
user
,
project:
project
,
commit_id:
ci_pipeline
.
sha
)
create
(
:event
,
target:
milestone
,
project:
project
,
action:
Event
::
CREATED
,
author:
user
)
project
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment