Commit 48d3e5fa authored by Maxim Rydkin's avatar Maxim Rydkin

replace `is_edited?` with `edited?`

parent edd56aea
......@@ -243,7 +243,9 @@ Style/PerlBackrefs:
# NamePrefixBlacklist: is_, has_, have_
# NameWhitelist: is_a?
Style/PredicateName:
Enabled: false
Enabled: true
# NamePrefix: is_
NamePrefixBlacklist: is_
# Offense count: 58
# Cop supports --auto-correct.
......
......@@ -202,7 +202,7 @@ class Projects::IssuesController < Projects::ApplicationController
task_status: @issue.task_status
}
if @issue.is_edited?
if @issue.edited?
response[:updated_at] = @issue.updated_at
response[:updated_by_name] = @issue.last_edited_by.name
response[:updated_by_path] = user_path(@issue.last_edited_by)
......
......@@ -178,7 +178,7 @@ module ApplicationHelper
end
def edited_time_ago_with_tooltip(object, placement: 'top', html_class: 'time_ago', exclude_author: false)
return unless object.is_edited?
return unless object.edited?
content_tag :small, class: 'edited-text' do
output = content_tag(:span, 'Edited ')
......
......@@ -229,7 +229,7 @@ module IssuablesHelper
end
def updated_at_by(issuable)
return {} unless issuable.is_edited?
return {} unless issuable.edited?
{
updatedAt: issuable.updated_at.to_time.iso8601,
......
module Editable
extend ActiveSupport::Concern
def is_edited?
def edited?
last_edited_at.present? && last_edited_at != created_at
end
......
require 'spec_helper'
describe Editable do
describe '#is_edited?' do
describe '#edited?' do
let(:issue) { create(:issue, last_edited_at: nil) }
let(:edited_issue) { create(:issue, created_at: 3.days.ago, last_edited_at: 2.days.ago) }
it { expect(issue.is_edited?).to eq(false) }
it { expect(edited_issue.is_edited?).to eq(true) }
it { expect(issue.edited?).to eq(false) }
it { expect(edited_issue.edited?).to eq(true) }
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