summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-03-24 14:24:22 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-03-24 14:24:22 -0300
commit39a51f9e1c8b42a5307b3d6bf74ca23712443695 (patch)
treefea8d986ba875b2a934d782a5995afedb4c94f6e
parent239560331ab5ef635a8739f5b2b85d0bcd531256 (diff)
downloadgitlab-ce-39a51f9e1c8b42a5307b3d6bf74ca23712443695.tar.gz
Rename `Event#proper?` to `Event#visible_to_user?`
-rw-r--r--app/helpers/events_helper.rb2
-rw-r--r--app/models/event.rb2
-rw-r--r--app/views/events/_event.html.haml2
-rw-r--r--spec/models/event_spec.rb44
4 files changed, 25 insertions, 25 deletions
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index a67a6b208e2..d3e5e3aa8b9 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -194,7 +194,7 @@ module EventsHelper
end
def event_to_atom(xml, event)
- if event.proper?(current_user)
+ if event.visible_to_user?(current_user)
xml.entry do
event_link = event_feed_url(event)
event_title = event_feed_title(event)
diff --git a/app/models/event.rb b/app/models/event.rb
index 2b963d4f2f6..12183524b79 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -73,7 +73,7 @@ class Event < ActiveRecord::Base
end
end
- def proper?(user = nil)
+ def visible_to_user?(user = nil)
if push?
true
elsif membership_changed?
diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml
index 2d9d9dd6342..42c2764e7e2 100644
--- a/app/views/events/_event.html.haml
+++ b/app/views/events/_event.html.haml
@@ -1,4 +1,4 @@
-- if event.proper?(current_user)
+- if event.visible_to_user?(current_user)
.event-item{class: "#{event.body? ? "event-block" : "event-inline" }"}
.event-item-timestamp
#{time_ago_with_tooltip(event.created_at)}
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb
index 697a34022ce..89909c2bcd7 100644
--- a/spec/models/event_spec.rb
+++ b/spec/models/event_spec.rb
@@ -59,13 +59,13 @@ describe Event, models: true do
end
it { expect(@event.push?).to be_truthy }
- it { expect(@event.proper?).to be_truthy }
+ it { expect(@event.visible_to_user?).to be_truthy }
it { expect(@event.tag?).to be_falsey }
it { expect(@event.branch_name).to eq("master") }
it { expect(@event.author).to eq(@user) }
end
- describe '#proper?' do
+ describe '#visible_to_user?' do
let(:project) { create(:empty_project, :public) }
let(:non_member) { create(:user) }
let(:member) { create(:user) }
@@ -86,21 +86,21 @@ describe Event, models: true do
context 'for non confidential issues' do
let(:target) { issue }
- it { expect(event.proper?(non_member)).to eq true }
- it { expect(event.proper?(author)).to eq true }
- it { expect(event.proper?(assignee)).to eq true }
- it { expect(event.proper?(member)).to eq true }
- it { expect(event.proper?(admin)).to eq true }
+ it { expect(event.visible_to_user?(non_member)).to eq true }
+ it { expect(event.visible_to_user?(author)).to eq true }
+ it { expect(event.visible_to_user?(assignee)).to eq true }
+ it { expect(event.visible_to_user?(member)).to eq true }
+ it { expect(event.visible_to_user?(admin)).to eq true }
end
context 'for confidential issues' do
let(:target) { confidential_issue }
- it { expect(event.proper?(non_member)).to eq false }
- it { expect(event.proper?(author)).to eq true }
- it { expect(event.proper?(assignee)).to eq true }
- it { expect(event.proper?(member)).to eq true }
- it { expect(event.proper?(admin)).to eq true }
+ it { expect(event.visible_to_user?(non_member)).to eq false }
+ it { expect(event.visible_to_user?(author)).to eq true }
+ it { expect(event.visible_to_user?(assignee)).to eq true }
+ it { expect(event.visible_to_user?(member)).to eq true }
+ it { expect(event.visible_to_user?(admin)).to eq true }
end
end
@@ -108,21 +108,21 @@ describe Event, models: true do
context 'on non confidential issues' do
let(:target) { note_on_issue }
- it { expect(event.proper?(non_member)).to eq true }
- it { expect(event.proper?(author)).to eq true }
- it { expect(event.proper?(assignee)).to eq true }
- it { expect(event.proper?(member)).to eq true }
- it { expect(event.proper?(admin)).to eq true }
+ it { expect(event.visible_to_user?(non_member)).to eq true }
+ it { expect(event.visible_to_user?(author)).to eq true }
+ it { expect(event.visible_to_user?(assignee)).to eq true }
+ it { expect(event.visible_to_user?(member)).to eq true }
+ it { expect(event.visible_to_user?(admin)).to eq true }
end
context 'on confidential issues' do
let(:target) { note_on_confidential_issue }
- it { expect(event.proper?(non_member)).to eq false }
- it { expect(event.proper?(author)).to eq true }
- it { expect(event.proper?(assignee)).to eq true }
- it { expect(event.proper?(member)).to eq true }
- it { expect(event.proper?(admin)).to eq true }
+ it { expect(event.visible_to_user?(non_member)).to eq false }
+ it { expect(event.visible_to_user?(author)).to eq true }
+ it { expect(event.visible_to_user?(assignee)).to eq true }
+ it { expect(event.visible_to_user?(member)).to eq true }
+ it { expect(event.visible_to_user?(admin)).to eq true }
end
end
end