##// END OF EJS Templates
Add etag check on the activity view to avoid rendering when not modified....
Jean-Philippe Lang -
r2868:a658679d29eb
parent child
Show More
@@ -299,6 +299,7 class ProjectsController < ApplicationController
299 299
300 300 events = @activity.events(@date_from, @date_to)
301 301
302 if events.empty? || stale?(:etag => [events.first, User.current])
302 303 respond_to do |format|
303 304 format.html {
304 305 @events_by_day = events.group_by(&:event_date)
@@ -314,6 +315,7 class ProjectsController < ApplicationController
314 315 render_feed(events, :title => "#{@project || Setting.app_title}: #{title}")
315 316 }
316 317 end
318 end
317 319
318 320 rescue ActiveRecord::RecordNotFound
319 321 render_404
@@ -66,6 +66,7 module Redmine
66 66 end
67 67
68 68 # Returns an array of events for the given date range
69 # sorted in reverse chronological order
69 70 def events(from = nil, to = nil, options={})
70 71 e = []
71 72 @options[:limit] = options[:limit]
@@ -76,8 +77,9 module Redmine
76 77 end
77 78 end
78 79
80 e.sort! {|a,b| b.event_datetime <=> a.event_datetime}
81
79 82 if options[:limit]
80 e.sort! {|a,b| b.event_date <=> a.event_date}
81 83 e = e.slice(0, options[:limit])
82 84 end
83 85 e
General Comments 0
You need to be logged in to leave comments. Login now