|
|
|
@ -4206,10 +4206,12 @@ class UsersController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def user_wathlist_and_fanslist
|
|
|
|
|
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.count
|
|
|
|
|
@user_watchlist = watch_query.order("#{Watcher.table_name}.id desc")
|
|
|
|
|
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.count
|
|
|
|
|
@user_fanlist = fan_query.order("#{Watcher.table_name}.id desc")
|
|
|
|
|
respond_to do |format|
|
|
|
|
|