summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-06-02 18:45:01 -0300
committerFelipe Artur <felipefac@gmail.com>2016-06-02 18:45:01 -0300
commit00be106eb733989bd4cf4ed7ebf1ba252d817afa (patch)
tree03dd43e12231f2703969d497f61f6ce1043182e3
parent74849f9783850676274a4e93a1b6335b5bb34f2e (diff)
downloadgitlab-ce-issue_12726.tar.gz
Do not remove issues/comments when deleting usersissue_12726
-rw-r--r--app/models/user.rb6
-rw-r--r--app/views/projects/notes/_note.html.haml12
2 files changed, 10 insertions, 8 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 172845c9d25..15e8e6b9fb8 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -70,13 +70,13 @@ class User < ActiveRecord::Base
has_many :snippets, dependent: :destroy, foreign_key: :author_id, class_name: "Snippet"
has_many :project_members, dependent: :destroy, class_name: 'ProjectMember'
- has_many :issues, dependent: :destroy, foreign_key: :author_id
- has_many :notes, dependent: :destroy, foreign_key: :author_id
+ has_many :issues, foreign_key: :author_id
+ has_many :notes, foreign_key: :author_id
has_many :merge_requests, dependent: :destroy, foreign_key: :author_id
has_many :events, dependent: :destroy, foreign_key: :author_id, class_name: "Event"
has_many :subscriptions, dependent: :destroy
has_many :recent_events, -> { order "id DESC" }, foreign_key: :author_id, class_name: "Event"
- has_many :assigned_issues, dependent: :destroy, foreign_key: :assignee_id, class_name: "Issue"
+ has_many :assigned_issues, foreign_key: :assignee_id, class_name: "Issue"
has_many :assigned_merge_requests, dependent: :destroy, foreign_key: :assignee_id, class_name: "MergeRequest"
has_many :oauth_applications, class_name: 'Doorkeeper::Application', as: :owner, dependent: :destroy
has_one :abuse_report, dependent: :destroy
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index f1045bbd8c3..9a60cfb6150 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -1,15 +1,17 @@
-- return unless note.author
+- note.author = User.new unless note.author
- return if note.cross_reference_not_visible_for?(current_user)
- note_editable = note_editable?(note)
%li.timeline-entry{ id: dom_id(note), class: ["note", "note-row-#{note.id}", ('system-note' if note.system)], data: {author_id: note.author.id, editable: note_editable} }
.timeline-entry-inner
- .timeline-icon
- %a{href: user_path(note.author)}
- = image_tag avatar_icon(note.author), alt: '', class: 'avatar s40'
+ - if note.author.valid?
+ .timeline-icon
+ %a{href: user_path(note.author)}
+ = image_tag avatar_icon(note.author), alt: '', class: 'avatar s40'
.timeline-content
.note-header
- = link_to_member(note.project, note.author, avatar: false)
+ - if note.author.valid?
+ = link_to_member(note.project, note.author, avatar: false)
.inline.note-headline-light
= note.author.to_reference
- unless note.system