summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Rydkin <maks.rydkin@gmail.com>2017-08-24 19:26:24 +0300
committerMaxim Rydkin <maks.rydkin@gmail.com>2017-08-29 11:14:41 +0300
commit48d3e5fac63ab7514f05b14a8645c344ba3d5f2b (patch)
tree8df0efc727234be6337073410001ebb818ff0c07
parentedd56aeaf48b119be2b29c5a03e03aa2a1152af9 (diff)
downloadgitlab-ce-48d3e5fac63ab7514f05b14a8645c344ba3d5f2b.tar.gz
replace `is_edited?` with `edited?`
-rw-r--r--.rubocop_todo.yml4
-rw-r--r--app/controllers/projects/issues_controller.rb2
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/helpers/issuables_helper.rb2
-rw-r--r--app/models/concerns/editable.rb2
-rw-r--r--spec/models/concerns/editable_spec.rb6
6 files changed, 10 insertions, 8 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 4b4f14efea4..4141d221039 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -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.
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index 8893a514207..1afaceac567 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -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)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index bcee81bdc15..07775a8b159 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -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 ')
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb
index 197c90c4081..2a748ce0a75 100644
--- a/app/helpers/issuables_helper.rb
+++ b/app/helpers/issuables_helper.rb
@@ -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,
diff --git a/app/models/concerns/editable.rb b/app/models/concerns/editable.rb
index 28623d257a6..c0a3099f676 100644
--- a/app/models/concerns/editable.rb
+++ b/app/models/concerns/editable.rb
@@ -1,7 +1,7 @@
module Editable
extend ActiveSupport::Concern
- def is_edited?
+ def edited?
last_edited_at.present? && last_edited_at != created_at
end
diff --git a/spec/models/concerns/editable_spec.rb b/spec/models/concerns/editable_spec.rb
index cd73af3b480..49a9a8ebcbc 100644
--- a/spec/models/concerns/editable_spec.rb
+++ b/spec/models/concerns/editable_spec.rb
@@ -1,11 +1,11 @@
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