GitLab steht Mittwoch, den 08. Juli, zwischen 09:00 und 13:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit 6461cbdf authored by Sean McGivern's avatar Sean McGivern

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
parents 66eec660 f5f243a0
......@@ -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
......
---
title: Fix notes being marked as edited after resolving
merge_request: 26143
author:
type: fixed
......@@ -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)
......
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