diff options
author | James Lopez <james@jameslopez.es> | 2016-05-20 10:57:10 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-05-20 10:57:10 +0200 |
commit | fa1884698db9d462ebff3301d42cbc7d43d62c49 (patch) | |
tree | 63a59240b85b9c556547d40817dc21de56aeecd3 | |
parent | 56b2f5e03f7f51be852515b63ef8767f5862f9b2 (diff) | |
download | gitlab-ce-fa1884698db9d462ebff3301d42cbc7d43d62c49.tar.gz |
a few nice to have and updated changelog
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/helpers/todos_helper.rb | 10 | ||||
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | app/models/todo.rb | 5 | ||||
-rw-r--r-- | app/views/projects/edit.html.haml | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/import_service.rb | 13 |
6 files changed, 30 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index 822fa4be565..992f782f803 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -33,6 +33,7 @@ v 8.8.0 (unreleased) - Fix Gravatar hint in user profile when Gravatar is disabled. !3988 (Artem Sidorenko) - Expire repository exists? and has_visible_content? caches after a push if necessary - Fix unintentional filtering bug in issues sorted by milestone due (Takuya Noguchi) + - GitLab project import and export functionality v 8.7.4 - Fix always showing build notification message when switching between merge requests diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 2f066682180..5317b55520b 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -9,8 +9,12 @@ module TodosHelper def todo_action_name(todo) case todo.action - when Todo::ASSIGNED then 'assigned you' - when Todo::MENTIONED then 'mentioned you on' + when Todo::ASSIGNED then + 'assigned you' + when Todo::MENTIONED then + 'mentioned you on' + when Todo::IMPORTED then + 'imported successfully' end end @@ -27,6 +31,8 @@ module TodosHelper if todo.for_commit? namespace_project_commit_path(todo.project.namespace.becomes(Namespace), todo.project, todo.target, anchor: anchor) + elsif todo.for_project? + namespace_project_path(todo.project.namespace, todo.project) else polymorphic_path([todo.project.namespace.becomes(Namespace), todo.project, todo.target], anchor: anchor) diff --git a/app/models/project.rb b/app/models/project.rb index 5003324f8f8..3bd5d048e10 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -94,6 +94,8 @@ class Project < ActiveRecord::Base attr_accessor :new_default_branch attr_accessor :old_path_with_namespace + alias_attribute :title, :name + # Relations belongs_to :creator, foreign_key: 'creator_id', class_name: 'User' belongs_to :group, -> { where(type: Group) }, foreign_key: 'namespace_id' diff --git a/app/models/todo.rb b/app/models/todo.rb index d85f7bfdf57..3333e56912a 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -19,6 +19,7 @@ class Todo < ActiveRecord::Base ASSIGNED = 1 MENTIONED = 2 + IMPORTED = 3 belongs_to :author, class_name: "User" belongs_to :note @@ -58,6 +59,10 @@ class Todo < ActiveRecord::Base target_type == "Commit" end + def for_project? + target_type == "Project" + end + # override to return commits, which are not active record def target if for_commit? diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 251fba474af..dcb46ad9d19 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -144,7 +144,7 @@ = link_to 'Generate new export', export_namespace_project_path(@project.namespace, @project), method: :post, class: "btn btn-default" - = link_to 'Download export', download_export_namespace_project_path(@project.namespace, @project), + = link_to 'Download latest export', download_export_namespace_project_path(@project.namespace, @project), method: :post, class: "btn btn-default" diff --git a/lib/gitlab/import_export/import_service.rb b/lib/gitlab/import_export/import_service.rb index acd734f0890..79794a4c34f 100644 --- a/lib/gitlab/import_export/import_service.rb +++ b/lib/gitlab/import_export/import_service.rb @@ -17,6 +17,7 @@ module Gitlab Gitlab::ImportExport::Importer.import(archive_file: @archive_file, shared: @shared) if [restore_version, restore_project_tree, restore_repo, restore_wiki_repo, restore_uploads].all? + Todo.create(attributes_for_todo) project_tree.project else project_tree.project.destroy if project_tree.project @@ -67,6 +68,18 @@ module Gitlab def wiki_repo_path File.join(@shared.export_path, 'project.wiki.bundle') end + + def attributes_for_todo + { user_id: @current_user.id, + project_id: project_tree.project.id, + target_type: 'Project', + target: project_tree.project, + action: Todo::IMPORTED, + author_id: @current_user.id, + state: :pending, + target_id: project_tree.project.id + } + end end end end |