From eef2d8ef1a52e0e6ea6be4b42c55051f229ca730 Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Mon, 12 Aug 2013 21:39:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e33104f9..8e44d4b7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -212,9 +212,13 @@ class UsersController < ApplicationController # @activity_pages = Paginator.new @activity_count, @limit, params['page'] # @offset ||= @activity_pages.offset # @events_by_day_ = @events.slice(@offset,@limit) - watcher = User.watched_by(@user) - watcher.push(User.current) - activity = Activity.where('user_id in (?)', watcher).order('id desc') + if @user == User.current + watcher = User.watched_by(@user) + watcher.push(User.current) + activity = Activity.where('user_id in (?)', watcher).order('id desc') + else + activity = Activity.where('user_id = ?', @user.id).order('id desc') + end @offset, @limit = api_offset_and_limit({:limit => 10}) @activity_count = activity.count @activity_pages = Paginator.new @activity_count, @limit, params['page']