Commit b041998d66aaf2a2542a4aee5420dcf9cd95e7cb
Committed by
Antonio Terceiro
1 parent
7e15d0cb
Exists in
master
and in
29 other branches
Events are displayed only if the user is allowed to see it
(ActionItem1646)
Showing
2 changed files
with
19 additions
and
2 deletions
Show diff stats
app/helpers/events_helper.rb
@@ -6,7 +6,7 @@ module EventsHelper | @@ -6,7 +6,7 @@ module EventsHelper | ||
6 | content_tag('h2', title) + | 6 | content_tag('h2', title) + |
7 | content_tag('div', | 7 | content_tag('div', |
8 | (events.any? ? | 8 | (events.any? ? |
9 | - content_tag('table', events.select { |item| item.public? }.map {|item| display_event_in_listing(item)}.join('')) : | 9 | + content_tag('table', events.select { |item| item.display_to?(user) }.map {|item| display_event_in_listing(item)}.join('')) : |
10 | content_tag('em', _('No events for this date'), :class => 'no-events') | 10 | content_tag('em', _('No events for this date'), :class => 'no-events') |
11 | ), :id => 'agenda-items' | 11 | ), :id => 'agenda-items' |
12 | ) | 12 | ) |
@@ -26,7 +26,7 @@ module EventsHelper | @@ -26,7 +26,7 @@ module EventsHelper | ||
26 | # the day itself | 26 | # the day itself |
27 | date, | 27 | date, |
28 | # is there any events in this date? | 28 | # is there any events in this date? |
29 | - events.any? do |event| | 29 | + events.select {|event| event.display_to?(user)}.any? do |event| |
30 | event.date_range.include?(date) | 30 | event.date_range.include?(date) |
31 | end, | 31 | end, |
32 | # is this date in the current month? | 32 | # is this date in the current month? |
features/events.feature
@@ -185,3 +185,20 @@ Feature: events | @@ -185,3 +185,20 @@ Feature: events | ||
185 | And I press "Spread this" | 185 | And I press "Spread this" |
186 | And I am on /profile/sample-community/events/2009/10/24 | 186 | And I am on /profile/sample-community/events/2009/10/24 |
187 | Then I should see "Another Conference" | 187 | Then I should see "Another Conference" |
188 | + | ||
189 | + Scenario: events that are not allowed to the user should not be displayed nor listed in the calendar | ||
190 | + Given the following events | ||
191 | + | owner | name | start_date | published | | ||
192 | + | josesilva | Unpublished event | 2009-10-25 | false | | ||
193 | + When I am on /profile/josesilva/events/2009/10/25 | ||
194 | + Then I should not see "Unpublished event" | ||
195 | + And I should not see "25" link | ||
196 | + | ||
197 | + Scenario: events that are allowed to the user should be displayed and listed in the calendar | ||
198 | + Given the following events | ||
199 | + | owner | name | start_date | published | | ||
200 | + | josesilva | Unpublished event | 2009-10-25 | false | | ||
201 | + And I am logged in as "josesilva" | ||
202 | + When I am on /profile/josesilva/events/2009/10/25 | ||
203 | + Then I should see "Unpublished event" | ||
204 | + And I should see "25" link |