diff options
-rw-r--r-- | app/models/user.rb | 6 | ||||
-rw-r--r-- | app/views/projects/notes/_note.html.haml | 12 |
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 |