# encoding: utf-8 #-- # Copyright (C) 2010 Tero Hänninen # Copyright (C) 2010 Marko Peltola # Copyright (C) 2008 David A. Cuadrado # Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) # Copyright (C) 2008 Johan Sørensen # Copyright (C) 2008 Tor Arne Vestbø # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . #++ class EventsController < ApplicationController def index # FIXME This query doesn't find any events whose target_type is 'User' or 'Event' @events = Event.paginate(:all, :order => "events.created_at desc", :page => params[:page], :include => [:user], :conditions => ["(target_type = :repo and target_id in (:pub_repos) and exists (select id from projects where publicity = :publicity_world and id = (select project_id from repositories where target_id = id))) or (target_type = :proj and exists (select id from projects where publicity = :publicity_world and id = target_id))", {:repo => 'Repository', :proj => 'Project', :pub_repos => Repository.public_to_world_or_site, :publicity_world => Project::PUBLICITY_WORLD}]) @atom_auto_discovery_url = events_path(:format => :atom) respond_to do |if_format_is| if_format_is.html {} if_format_is.atom {} end end def commits @event = Event.find(params[:id]) if stale?(:etag => @event, :last_modified => @event.created_at) @commits = @event.events.commits respond_to do |wants| wants.js end expires_in 30.minutes end end end