BigW Consortium Gitlab

Commit 48d3e5fa by Maxim Rydkin

replace `is_edited?` with `edited?`

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