Rename `Event#proper?` to `Event#visible_to_user?`

parent 23956033
...@@ -194,7 +194,7 @@ module EventsHelper ...@@ -194,7 +194,7 @@ module EventsHelper
end end
def event_to_atom(xml, event) def event_to_atom(xml, event)
if event.proper?(current_user) if event.visible_to_user?(current_user)
xml.entry do xml.entry do
event_link = event_feed_url(event) event_link = event_feed_url(event)
event_title = event_feed_title(event) event_title = event_feed_title(event)
......
...@@ -73,7 +73,7 @@ class Event < ActiveRecord::Base ...@@ -73,7 +73,7 @@ class Event < ActiveRecord::Base
end end
end end
def proper?(user = nil) def visible_to_user?(user = nil)
if push? if push?
true true
elsif membership_changed? elsif membership_changed?
......
- if event.proper?(current_user) - if event.visible_to_user?(current_user)
.event-item{class: "#{event.body? ? "event-block" : "event-inline" }"} .event-item{class: "#{event.body? ? "event-block" : "event-inline" }"}
.event-item-timestamp .event-item-timestamp
#{time_ago_with_tooltip(event.created_at)} #{time_ago_with_tooltip(event.created_at)}
......
...@@ -59,13 +59,13 @@ describe Event, models: true do ...@@ -59,13 +59,13 @@ describe Event, models: true do
end end
it { expect(@event.push?).to be_truthy } 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.tag?).to be_falsey }
it { expect(@event.branch_name).to eq("master") } it { expect(@event.branch_name).to eq("master") }
it { expect(@event.author).to eq(@user) } it { expect(@event.author).to eq(@user) }
end end
describe '#proper?' do describe '#visible_to_user?' do
let(:project) { create(:empty_project, :public) } let(:project) { create(:empty_project, :public) }
let(:non_member) { create(:user) } let(:non_member) { create(:user) }
let(:member) { create(:user) } let(:member) { create(:user) }
...@@ -86,21 +86,21 @@ describe Event, models: true do ...@@ -86,21 +86,21 @@ describe Event, models: true do
context 'for non confidential issues' do context 'for non confidential issues' do
let(:target) { issue } let(:target) { issue }
it { expect(event.proper?(non_member)).to eq true } it { expect(event.visible_to_user?(non_member)).to eq true }
it { expect(event.proper?(author)).to eq true } it { expect(event.visible_to_user?(author)).to eq true }
it { expect(event.proper?(assignee)).to eq true } it { expect(event.visible_to_user?(assignee)).to eq true }
it { expect(event.proper?(member)).to eq true } it { expect(event.visible_to_user?(member)).to eq true }
it { expect(event.proper?(admin)).to eq true } it { expect(event.visible_to_user?(admin)).to eq true }
end end
context 'for confidential issues' do context 'for confidential issues' do
let(:target) { confidential_issue } let(:target) { confidential_issue }
it { expect(event.proper?(non_member)).to eq false } it { expect(event.visible_to_user?(non_member)).to eq false }
it { expect(event.proper?(author)).to eq true } it { expect(event.visible_to_user?(author)).to eq true }
it { expect(event.proper?(assignee)).to eq true } it { expect(event.visible_to_user?(assignee)).to eq true }
it { expect(event.proper?(member)).to eq true } it { expect(event.visible_to_user?(member)).to eq true }
it { expect(event.proper?(admin)).to eq true } it { expect(event.visible_to_user?(admin)).to eq true }
end end
end end
...@@ -108,21 +108,21 @@ describe Event, models: true do ...@@ -108,21 +108,21 @@ describe Event, models: true do
context 'on non confidential issues' do context 'on non confidential issues' do
let(:target) { note_on_issue } let(:target) { note_on_issue }
it { expect(event.proper?(non_member)).to eq true } it { expect(event.visible_to_user?(non_member)).to eq true }
it { expect(event.proper?(author)).to eq true } it { expect(event.visible_to_user?(author)).to eq true }
it { expect(event.proper?(assignee)).to eq true } it { expect(event.visible_to_user?(assignee)).to eq true }
it { expect(event.proper?(member)).to eq true } it { expect(event.visible_to_user?(member)).to eq true }
it { expect(event.proper?(admin)).to eq true } it { expect(event.visible_to_user?(admin)).to eq true }
end end
context 'on confidential issues' do context 'on confidential issues' do
let(:target) { note_on_confidential_issue } let(:target) { note_on_confidential_issue }
it { expect(event.proper?(non_member)).to eq false } it { expect(event.visible_to_user?(non_member)).to eq false }
it { expect(event.proper?(author)).to eq true } it { expect(event.visible_to_user?(author)).to eq true }
it { expect(event.proper?(assignee)).to eq true } it { expect(event.visible_to_user?(assignee)).to eq true }
it { expect(event.proper?(member)).to eq true } it { expect(event.visible_to_user?(member)).to eq true }
it { expect(event.proper?(admin)).to eq true } it { expect(event.visible_to_user?(admin)).to eq true }
end end
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