Commit fa188469 authored by James Lopez's avatar James Lopez

a few nice to have and updated changelog

parent 56b2f5e0
......@@ -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
......
......@@ -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)
......
......@@ -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'
......
......@@ -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?
......
......@@ -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"
......
......@@ -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
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