Skip to content
Snippets Groups Projects
Commit 11e87984 authored by Sean McGivern's avatar Sean McGivern Committed by GitLab Release Tools Bot
Browse files

Merge branch '57330-fix-comment-edited' into 'master'

Hide "Edited" when note is transformed or resolved

Closes #57330

See merge request gitlab-org/gitlab-ce!26143

(cherry picked from commit 6461cbdf)

f5f243a0 Hide "Edited" when note is transformed or resolved
parent 14a681fd
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -313,6 +313,14 @@ class Note < ActiveRecord::Base
!system?
end
 
# Since we're using `updated_at` as `last_edited_at`, it could be touched by transforming / resolving a note.
# This makes sure it is only marked as edited when the note body is updated.
def edited?
return false if updated_by.blank?
super
end
def cross_reference_not_visible_for?(user)
cross_reference? && !all_referenced_mentionables_allowed?(user)
end
Loading
Loading
---
title: Fix notes being marked as edited after resolving
merge_request: 26143
author:
type: fixed
Loading
Loading
@@ -208,6 +208,24 @@ describe Note do
end
end
 
describe "edited?" do
let(:note) { build(:note, updated_by_id: nil, created_at: Time.now, updated_at: Time.now + 5.hours) }
context "with updated_by" do
it "returns true" do
note.updated_by = build(:user)
expect(note.edited?).to be_truthy
end
end
context "without updated_by" do
it "returns false" do
expect(note.edited?).to be_falsy
end
end
end
describe "confidential?" do
it "delegates to noteable" do
issue_note = build(:note, :on_issue)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment