Merge branch 'main' into expand-activity-columns
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
class Admin::StatsController < AdminController
|
||||
disallow_account_scope
|
||||
|
||||
layout "public"
|
||||
|
||||
def show
|
||||
@accounts_total = Account.count
|
||||
@accounts_last_7_days = Account.where(created_at: 7.days.ago..).count
|
||||
@accounts_last_24_hours = Account.where(created_at: 24.hours.ago..).count
|
||||
|
||||
@identities_total = Identity.count
|
||||
@identities_last_7_days = Identity.where(created_at: 7.days.ago..).count
|
||||
@identities_last_24_hours = Identity.where(created_at: 24.hours.ago..).count
|
||||
|
||||
@top_accounts = Account
|
||||
.where("cards_count > 0")
|
||||
.order(cards_count: :desc)
|
||||
.limit(20)
|
||||
end
|
||||
end
|
||||
@@ -22,7 +22,7 @@ module Authorization
|
||||
end
|
||||
|
||||
def ensure_staff
|
||||
head :forbidden unless Current.user.staff?
|
||||
head :forbidden unless Current.identity.staff?
|
||||
end
|
||||
|
||||
def ensure_can_access_account
|
||||
|
||||
@@ -29,10 +29,14 @@ class JoinCodesController < ApplicationController
|
||||
|
||||
private
|
||||
def set_join_code
|
||||
@join_code ||= Account::JoinCode.active.find_by(code: params.expect(:code), account: Current.account)
|
||||
@join_code ||= Account::JoinCode.find_by(code: params.expect(:code), account: Current.account)
|
||||
end
|
||||
|
||||
def ensure_join_code_is_valid
|
||||
head :not_found unless @join_code&.active?
|
||||
if @join_code.nil?
|
||||
head :not_found
|
||||
elsif !@join_code.active?
|
||||
render :inactive, status: :gone
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class My::PinsController < ApplicationController
|
||||
def index
|
||||
@pins = Current.user.pins.includes(:card).ordered.limit(20)
|
||||
fresh_when @pins
|
||||
fresh_when etag: [ @pins, @pins.collect(&:card) ]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class SessionsController < ApplicationController
|
||||
# FIXME: Remove this before launch!
|
||||
if Rails.env.remote?
|
||||
unless Rails.env.local?
|
||||
http_basic_authenticate_with \
|
||||
name: Rails.application.credentials.account_signup_http_basic_auth.name,
|
||||
password: Rails.application.credentials.account_signup_http_basic_auth.password,
|
||||
|
||||
Reference in New Issue
Block a user