diff --git a/models/site.rb b/models/site.rb index a20eca15..5137a3d7 100644 --- a/models/site.rb +++ b/models/site.rb @@ -858,12 +858,17 @@ class Site < Sequel::Model end def latest_events(current_page=1, limit=10) - events_dataset.order(:created_at.desc).paginate(current_page, limit) + site_id = self.id + Event.where{Sequel.|({site_id: site_id}, {actioning_site_id: site_id})}. + order(:created_at.desc). + paginate(current_page, limit) end def news_feed(current_page=1, limit=10) following_ids = self.followings_dataset.select(:site_id).all.collect {|f| f.site_id} - Event.filter(site_id: following_ids+[self.id]). + search_ids = following_ids+[self.id] + + Event.where{Sequel.|({site_id: search_ids}, {actioning_site_id: search_ids})}. order(:created_at.desc). paginate(current_page, limit) end diff --git a/views/_news.erb b/views/_news.erb index 75acd7c5..81d06813 100644 --- a/views/_news.erb +++ b/views/_news.erb @@ -30,7 +30,7 @@ started following <% if current_site && event_site.id == current_site.id %> - your site! + your site. <% else %> <% if event_site.supporter? && !event_site.ended_supporter? %><% end %><%= event_site.username %> <% end %> @@ -60,7 +60,7 @@ <% site_change_filenames.each do |f| %>
- + "> <% if site_change_file_display_class(f) == 'html' %> <% elsif site_change_file_display_class(f) == 'image' %> diff --git a/views/_news_profile_comment.erb b/views/_news_profile_comment.erb index 69fc1028..7911b079 100644 --- a/views/_news_profile_comment.erb +++ b/views/_news_profile_comment.erb @@ -4,19 +4,17 @@
- <% if current_site && current_site.id == actioning_site.id && request.path == '/' %> + <% if current_site && current_site.id == actioning_site.id %> You <% else %> <% if actioning_site.supporter? && !actioning_site.ended_supporter? %><% end %>
<%= actioning_site.username %> <% end %> - <% if request.path == '/' %> <% if current_site && current_site.id == profile_comment.site_id %> left a comment on your profile: <% else %> left a comment on <% if profile_comment.site.supporter? && !profile_comment.site.ended_supporter? %><% end %><%= profile_comment.site.username %><%= site.username[site.username.length-1] == 's' ? "’" : "'s" %> profile: <% end %> - <% end %> <%= profile_comment.created_at.ago %>