mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 22:57:40 +08:00
Refactor + Fix: Wasn't correctly loading activity streams. Code is a lot more Ember-y now.
This commit is contained in:
@ -175,6 +175,19 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def fetch_user_from_params
|
||||
username_lower = params[:username].downcase
|
||||
username_lower.gsub!(/\.json$/, '')
|
||||
|
||||
user = User.where(username_lower: username_lower).first
|
||||
raise Discourse::NotFound.new if user.blank?
|
||||
|
||||
guardian.ensure_can_see!(user)
|
||||
user
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def render_json_error(obj)
|
||||
|
@ -1,11 +1,13 @@
|
||||
class UserActionsController < ApplicationController
|
||||
def index
|
||||
requires_parameters(:user_id)
|
||||
requires_parameters(:username)
|
||||
per_chunk = 60
|
||||
|
||||
user = fetch_user_from_params
|
||||
|
||||
opts = {
|
||||
user_id: params[:user_id].to_i,
|
||||
offset: params[:offset],
|
||||
user_id: user.id,
|
||||
offset: params[:offset].to_i,
|
||||
limit: per_chunk,
|
||||
action_types: (params[:filter] || "").split(",").map(&:to_i),
|
||||
guardian: guardian,
|
||||
@ -29,4 +31,5 @@ class UserActionsController < ApplicationController
|
||||
# todo
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
@ -8,7 +8,7 @@ class UsersController < ApplicationController
|
||||
|
||||
before_filter :ensure_logged_in, only: [:username, :update, :change_email, :user_preferences_redirect]
|
||||
|
||||
# we need to allow account creation with bad CSRF tokens, if people are caching, the CSRF token on the
|
||||
# we need to allow account creation with bad CSRF tokens, if people are caching, the CSRF token on the
|
||||
# page is going to be empty, this means that server will see an invalid CSRF and blow the session
|
||||
# once that happens you can't log in with social
|
||||
skip_before_filter :verify_authenticity_token, only: [:create]
|
||||
@ -348,17 +348,6 @@ class UsersController < ApplicationController
|
||||
'3019774c067cc2b'
|
||||
end
|
||||
|
||||
def fetch_user_from_params
|
||||
username_lower = params[:username].downcase
|
||||
username_lower.gsub!(/\.json$/, '')
|
||||
|
||||
user = User.where(username_lower: username_lower).first
|
||||
raise Discourse::NotFound.new if user.blank?
|
||||
|
||||
guardian.ensure_can_see!(user)
|
||||
user
|
||||
end
|
||||
|
||||
def honeypot_or_challenge_fails?(params)
|
||||
params[:password_confirmation] != honeypot_value ||
|
||||
params[:challenge] != challenge_value.try(:reverse)
|
||||
|
Reference in New Issue
Block a user