|
|
|
@ -4178,7 +4178,8 @@ class UsersController < ApplicationController
|
|
|
|
|
|
|
|
|
|
###add by huang
|
|
|
|
|
def user_watchlist
|
|
|
|
|
watch_query = User.watched_by(@user.id)
|
|
|
|
|
watch_query = User.joins('left join watchers on watchers.watchable_id = users.id and watchers.watchable_type in ("Principal", "User")')
|
|
|
|
|
.where('watchers.user_id = ?', @user.id)
|
|
|
|
|
@user_watchlist_count = watch_query.size
|
|
|
|
|
@user_watchlist = watch_query.order("#{Watcher.table_name}.id desc")
|
|
|
|
|
@limit = 10
|
|
|
|
@ -4191,7 +4192,8 @@ class UsersController < ApplicationController
|
|
|
|
|
|
|
|
|
|
###add by huang
|
|
|
|
|
def user_fanslist
|
|
|
|
|
fan_query = @user.watcher_users
|
|
|
|
|
fan_query = User.joins('left join watchers on watchers.user_id = users.id and watchers.watchable_type in ("Principal", "User")')
|
|
|
|
|
.where('watchers.watchable_id = ?', @user.id)
|
|
|
|
|
@user_fanlist_count = fan_query.size
|
|
|
|
|
@user_fanlist = fan_query.order("#{Watcher.table_name}.id desc")
|
|
|
|
|
|
|
|
|
|