repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/csrf_token_injector.rb | app/controllers/concerns/csrf_token_injector.rb | # frozen_string_literal: true
module CsrfTokenInjector
extend ActiveSupport::Concern
TOKEN_PLACEHOLDER = "_CROSS_SITE_REQUEST_FORGERY_PROTECTION_TOKEN__"
SAFE_INSERTION_SELECTOR = /(<meta\s+name=["']csrf-token["']\s+content=["'])#{Regexp.escape(TOKEN_PLACEHOLDER)}(["'])/i
def rewrite_csrf_token(html, token)... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/pundit_authorization.rb | app/controllers/concerns/pundit_authorization.rb | # frozen_string_literal: true
module PunditAuthorization
extend ActiveSupport::Concern
include Pundit::Authorization
included do
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
helper_method :pundit_user
end
def pundit_user
@_pundit_user ||= SellerContext.new(user: logged_in... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/current_seller.rb | app/controllers/concerns/current_seller.rb | # frozen_string_literal: true
module CurrentSeller
extend ActiveSupport::Concern
included do
helper_method :current_seller
before_action :verify_current_seller
end
def current_seller
return unless user_signed_in?
@_current_seller ||= find_seller_from_cookie(cookies.encrypted[:current_seller... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/affiliate_query_params.rb | app/controllers/concerns/affiliate_query_params.rb | # frozen_string_literal: true
module AffiliateQueryParams
def fetch_affiliate_id(params)
id = (params[:affiliate_id].presence || params[:a].presence).to_i
id.zero? ? nil : id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/oauth_application_config.rb | app/controllers/concerns/oauth_application_config.rb | # frozen_string_literal: true
module OauthApplicationConfig
extend ActiveSupport::Concern
included do
before_action :set_oauth_application, only: :new
end
def set_oauth_application
return if params[:next].blank?
begin
next_url = URI.parse(params[:next])
rescue URI::InvalidURIError
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/helper_widget.rb | app/controllers/concerns/helper_widget.rb | # frozen_string_literal: true
module HelperWidget
extend ActiveSupport::Concern
included do
helper_method :helper_widget_host, :helper_session
end
def helper_widget_host
GlobalConfig.get("HELPER_WIDGET_HOST")
end
def helper_session
return unless current_seller
timestamp = (Time.current.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/rack_mini_profiler_authorization.rb | app/controllers/concerns/rack_mini_profiler_authorization.rb | # frozen_string_literal: true
module RackMiniProfilerAuthorization
extend ActiveSupport::Concern
included do
before_action :authorize_rack_mini_profiler
end
private
def authorize_rack_mini_profiler
Rack::MiniProfiler.authorize_request if authorize_rack_mini_profiler?
end
def authorize_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/two_factor_authentication_validator.rb | app/controllers/concerns/two_factor_authentication_validator.rb | # frozen_string_literal: true
module TwoFactorAuthenticationValidator
extend ActiveSupport::Concern
TWO_FACTOR_AUTH_USER_ID_SESSION_NAME = :verify_two_factor_auth_for
private_constant :TWO_FACTOR_AUTH_USER_ID_SESSION_NAME
def skip_two_factor_authentication?(user)
# Skip 2FA if it's not enabled for the us... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/custom_domain_config.rb | app/controllers/concerns/custom_domain_config.rb | # frozen_string_literal: true
module CustomDomainConfig
def user_by_domain(host)
user_by_subdomain(host) || user_by_custom_domain(host)
end
def set_user_and_custom_domain_config
if GumroadDomainConstraint.matches?(request)
set_user
else
set_user_by_domain
@facebook_sdk_disabled = ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/create_discover_search.rb | app/controllers/concerns/create_discover_search.rb | # frozen_string_literal: true
module CreateDiscoverSearch
def create_discover_search!(extras = {})
return if is_bot?
return unless Feature.active?(:store_discover_searches, OpenStruct.new(flipper_id: cookies[:_gumroad_guid]))
DiscoverSearch.transaction do
search = DiscoverSearch.create!({
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/logged_in_user.rb | app/controllers/concerns/logged_in_user.rb | # frozen_string_literal: true
module LoggedInUser
extend ActiveSupport::Concern
included do
helper_method :logged_in_user
end
# Usage of current_user is restricted to ensure current_user is not used accidentaly instead of current_seller
def logged_in_user
impersonated_user || current_user
end
end... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/mass_transfer_purchases.rb | app/controllers/concerns/mass_transfer_purchases.rb | # frozen_string_literal: true
module MassTransferPurchases
extend ActiveSupport::Concern
private
def transfer_purchases(user:, new_email:)
purchases = Purchase.where(email: user.email)
error_message = if user.suspended?
"Mass-transferring purchases for a suspended user is not allowed."
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/mass_blocker.rb | app/controllers/concerns/mass_blocker.rb | # frozen_string_literal: true
module MassBlocker
extend ActiveSupport::Concern
# Records can be separated by whitespaces or commas
DELIMITER_REGEX = /\s|,/
BATCH_SIZE = 1_000
private
def schedule_mass_block(identifiers:, object_type:, expires_in: nil)
array_of_mass_block_args = identifiers.split(... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/discover_curated_products.rb | app/controllers/concerns/discover_curated_products.rb | # frozen_string_literal: true
module DiscoverCuratedProducts
def taxonomies_for_nav(recommended_products: nil)
Discover::TaxonomyPresenter.new.taxonomies_for_nav(recommended_products: curated_products.map(&:product))
end
def curated_products
@root_recommended_products ||= begin
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/inertia_rendering.rb | app/controllers/concerns/inertia_rendering.rb | # frozen_string_literal: true
module InertiaRendering
extend ActiveSupport::Concern
include ApplicationHelper
included do
inertia_share do
RenderingExtension.custom_context(view_context).merge(
authenticity_token: form_authenticity_token,
flash: inertia_flash_props,
title: @tit... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/validate_recaptcha.rb | app/controllers/concerns/validate_recaptcha.rb | # frozen_string_literal: true
module ValidateRecaptcha
ENTERPRISE_VERIFICATION_URL =
"https://recaptchaenterprise.googleapis.com/v1/projects/#{GOOGLE_CLOUD_PROJECT_ID}/" \
"assessments?key=#{GlobalConfig.get("ENTERPRISE_RECAPTCHA_API_KEY")}"
private_constant :ENTERPRISE_VERIFICATION_URL
private
def... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/throttling.rb | app/controllers/concerns/throttling.rb | # frozen_string_literal: true
module Throttling
extend ActiveSupport::Concern
private
def throttle!(key:, limit:, period:, redis: $redis)
count = redis.incr(key)
redis.expire(key, period.to_i) if count == 1
if count > limit
retry_after = redis.ttl(key) || period.to_i
respons... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/mass_unblocker.rb | app/controllers/concerns/mass_unblocker.rb | # frozen_string_literal: true
module MassUnblocker
extend ActiveSupport::Concern
private
def schedule_mass_unblock(identifiers:)
array_of_mass_unblock_args = identifiers.split(MassBlocker::DELIMITER_REGEX)
.select(&:present?)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/affiliate_cookie.rb | app/controllers/concerns/affiliate_cookie.rb | # frozen_string_literal: true
module AffiliateCookie
include AffiliateQueryParams
private
def set_affiliate_cookie
affiliate_id = fetch_affiliate_id(params)
return unless affiliate_id.present?
affiliate = Affiliate.find_by_external_id_numeric(affiliate_id)
create_affiliate_id_cookie(af... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/custom_domain_route_builder.rb | app/controllers/concerns/custom_domain_route_builder.rb | # frozen_string_literal: true
module CustomDomainRouteBuilder
extend ActiveSupport::Concern
included do
before_action :set_is_user_custom_domain
helper_method :build_view_post_route
end
def build_view_post_route(post:, purchase_id: nil)
return if post&.slug.blank?
if @is_user_custom_domain
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/utm_link_tracking.rb | app/controllers/concerns/utm_link_tracking.rb | # frozen_string_literal: true
module UtmLinkTracking
extend ActiveSupport::Concern
private
def track_utm_link_visit
return unless request.get?
required_params = {
utm_source: params[:utm_source].presence,
utm_medium: params[:utm_medium].presence,
utm_campaign: params[:utm_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/search_products.rb | app/controllers/concerns/search_products.rb | # frozen_string_literal: true
module SearchProducts
BLACK_FRIDAY_CODE = "BLACKFRIDAY2025"
ALLOWED_OFFER_CODES = [BLACK_FRIDAY_CODE].freeze
private
def search_products(params)
filetype_options = Link.filetype_options(params)
filetype_response = Link.search(filetype_options)
product_options ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/admin_action_tracker.rb | app/controllers/concerns/admin_action_tracker.rb | # frozen_string_literal: true
module AdminActionTracker
extend ActiveSupport::Concern
included do
before_action :track_admin_action_call
end
private
def track_admin_action_call
AdminActionCallInfo.find_by(controller_name: self.class.name, action_name:)&.increment!(:call_count)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/record_media_location.rb | app/controllers/concerns/record_media_location.rb | # frozen_string_literal: true
module RecordMediaLocation
private
def record_media_location(params)
return false if params[:url_redirect_id].blank? || params[:product_file_id].blank? || params[:location].blank?
url_redirect_id = ObfuscateIds.decrypt(params[:url_redirect_id])
purchase_id = param... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/dashboard_preference.rb | app/controllers/concerns/dashboard_preference.rb | # frozen_string_literal: true
module DashboardPreference
COOKIE_NAME = "last_viewed_dashboard"
SALES_DASHBOARD = "sales"
AUDIENCE_DASHBOARD = "audience"
private_constant :COOKIE_NAME, :SALES_DASHBOARD, :AUDIENCE_DASHBOARD
private
def preferred_dashboard_url
return @_preferred_dashboard_url if defi... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/process_refund.rb | app/controllers/concerns/process_refund.rb | # frozen_string_literal: true
module ProcessRefund
private
def process_refund(seller:, user:, purchase_external_id:, amount:, impersonating: false)
# We don't support commas in refund amount
# Reference: https://github.com/gumroad/web/pull/17747
return render json: { success: false, message: "C... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/admin/commentable.rb | app/controllers/concerns/admin/commentable.rb | # frozen_string_literal: true
module Admin::Commentable
include Pagy::Backend
def index
pagination, comments = pagy(
commentable.comments.includes(:author).references(:author).order(created_at: :desc),
limit: params[:per_page] || 20,
page: params[:page] || 1
)
render json: {
c... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/admin/fetch_user.rb | app/controllers/concerns/admin/fetch_user.rb | # frozen_string_literal: true
module Admin::FetchUser
private
def fetch_user
@user = if user_param.include?("@")
User.find_by(email: user_param)
else
User.where(username: user_param)
.or(User.where(id: user_param))
.or(User.where(external_id: user_param))
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/admin/list_paginated_users.rb | app/controllers/concerns/admin/list_paginated_users.rb | # frozen_string_literal: true
module Admin::ListPaginatedUsers
extend ActiveSupport::Concern
include Pagy::Backend
# We list 5 users per page by default for the following reasons:
# - Feature: A list of user cards is used for the refund queue or for searching users, so we don't need to display too many users ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/concerns/admin/users/list_paginated_products.rb | app/controllers/concerns/admin/users/list_paginated_products.rb | # frozen_string_literal: true
module Admin::Users::ListPaginatedProducts
include Pagy::Backend
PRODUCTS_ORDER = Arel.sql("ISNULL(COALESCE(purchase_disabled_at, banned_at, links.deleted_at)) DESC, created_at DESC")
PRODUCTS_PER_PAGE = 10
private
def list_paginated_products(user:, products:, inertia_templa... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/workflows/emails_controller.rb | app/controllers/workflows/emails_controller.rb | # frozen_string_literal: true
class Workflows::EmailsController < Sellers::BaseController
before_action :set_workflow
before_action :authorize_workflow
layout "inertia"
FLASH_CHANGES_SAVED = "Changes saved!"
FLASH_PREVIEW_EMAIL_SENT = "A preview has been sent to your email."
FLASH_WORKFLOW_PUBLISHED = "W... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/payouts/exportables_controller.rb | app/controllers/payouts/exportables_controller.rb | # frozen_string_literal: true
class Payouts::ExportablesController < Sellers::BaseController
include PayoutsHelper
before_action :load_years_with_payouts
def index
authorize :balance, :export?
selected_year = params[:year]&.to_i
selected_year = @years_with_payouts.include?(selected_year) ? selecte... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/payouts/exports_controller.rb | app/controllers/payouts/exports_controller.rb | # frozen_string_literal: true
class Payouts::ExportsController < Sellers::BaseController
include PayoutsHelper
before_action :load_payout_ids
def create
authorize :balance, :export?
ExportPayoutData.perform_async(@payout_ids, impersonating_user&.id || logged_in_user.id)
head :ok
end
private
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/affiliate_requests/onboarding_form_controller.rb | app/controllers/affiliate_requests/onboarding_form_controller.rb | # frozen_string_literal: true
class AffiliateRequests::OnboardingFormController < Sellers::BaseController
before_action :authenticate_user!
before_action :set_published_products, only: [:update]
def update
authorize [:affiliate_requests, :onboarding_form]
user_product_external_ids = @published_products... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/purchases/pings_controller.rb | app/controllers/purchases/pings_controller.rb | # frozen_string_literal: true
class Purchases::PingsController < Sellers::BaseController
before_action :set_purchase
def create
authorize [:audience, @purchase], :create_ping?
@purchase.send_notification_webhook_from_ui
head :no_content
end
private
def set_purchase
(@purchase = curren... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/purchases/product_controller.rb | app/controllers/purchases/product_controller.rb | # frozen_string_literal: true
class Purchases::ProductController < ApplicationController
before_action :set_purchase
def show
@purchase_product_presenter = PurchaseProductPresenter.new(@purchase)
# Ensure that the React component receives the same props as the product page, in case ProductPresenter.produc... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/purchases/dispute_evidence_controller.rb | app/controllers/purchases/dispute_evidence_controller.rb | # frozen_string_literal: true
class Purchases::DisputeEvidenceController < ApplicationController
before_action :set_purchase, :set_dispute_evidence, :check_if_needs_redirect
def show
@dispute_evidence_page_presenter = DisputeEvidencePagePresenter.new(@dispute_evidence)
@title = "Submit additional informat... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/purchases/variants_controller.rb | app/controllers/purchases/variants_controller.rb | # frozen_string_literal: true
class Purchases::VariantsController < Sellers::BaseController
before_action :set_purchase
def update
authorize [:audience, @purchase]
success = Purchase::VariantUpdaterService.new(
purchase: @purchase,
variant_id: params[:variant_id],
quantity: params[:quan... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/integrations/zoom_controller.rb | app/controllers/integrations/zoom_controller.rb | # frozen_string_literal: true
class Integrations::ZoomController < ApplicationController
before_action :authenticate_user!, except: [:oauth_redirect]
def account_info
zoom_api = ZoomApi.new
oauth_response = zoom_api.oauth_token(params[:code], oauth_redirect_integrations_zoom_index_url)
access_token = ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/integrations/circle_controller.rb | app/controllers/integrations/circle_controller.rb | # frozen_string_literal: true
class Integrations::CircleController < Sellers::BaseController
before_action :skip_authorization
def communities
return render json: { success: false } if params[:api_key].blank?
communities_response = CircleApi.new(params[:api_key]).get_communities
return render json: {... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/integrations/google_calendar_controller.rb | app/controllers/integrations/google_calendar_controller.rb | # frozen_string_literal: true
class Integrations::GoogleCalendarController < ApplicationController
before_action :authenticate_user!, except: [:oauth_redirect]
def account_info
gcal_api = GoogleCalendarApi.new
oauth_response = gcal_api.oauth_token(params[:code], oauth_redirect_integrations_google_calendar... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/integrations/discord_controller.rb | app/controllers/integrations/discord_controller.rb | # frozen_string_literal: true
class Integrations::DiscordController < ApplicationController
before_action :authenticate_user!, except: [:oauth_redirect, :join_server, :leave_server]
def server_info
discord_api = DiscordApi.new
oauth_response = discord_api.oauth_token(params[:code], oauth_redirect_integrat... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/user/omniauth_callbacks_controller.rb | app/controllers/user/omniauth_callbacks_controller.rb | # frozen_string_literal: true
class User::OmniauthCallbacksController < Devise::OmniauthCallbacksController
REQ_PARAM_STATE = "state"
# Log in user through FB OAuth
def facebook
auth_params = request.env["omniauth.params"]
if !auth_params.nil? && !auth_params[REQ_PARAM_STATE].nil? &&
auth_params[... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/user/passwords_controller.rb | app/controllers/user/passwords_controller.rb | # frozen_string_literal: true
class User::PasswordsController < Devise::PasswordsController
def new
e404
end
def create
email = params[:user][:email]
if EmailFormatValidator.valid?(email)
@user = User.alive.by_email(email).first
return head :no_content if @user&.send_reset_password_instr... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/user/invalidate_active_sessions_controller.rb | app/controllers/user/invalidate_active_sessions_controller.rb | # frozen_string_literal: true
class User::InvalidateActiveSessionsController < Sellers::BaseController
def update
user = current_seller
authorize [:settings, :main, user], :invalidate_active_sessions?
user.invalidate_active_sessions!
sign_out
flash[:notice] = "You have been signed out from all... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/custom_domain/verifications_controller.rb | app/controllers/custom_domain/verifications_controller.rb | # frozen_string_literal: true
class CustomDomain::VerificationsController < Sellers::BaseController
def create
authorize [:settings, :advanced, current_seller], :show?
has_valid_configuration = CustomDomainVerificationService.new(domain: params[:domain]).process
passes_model_validation =
if param... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/password_controller.rb | app/controllers/settings/password_controller.rb | # frozen_string_literal: true
class Settings::PasswordController < Settings::BaseController
before_action :set_user
before_action :authorize
def show
@title = "Settings"
render inertia: "Settings/Password/Show", props: settings_presenter.password_props
end
def update
if @user.provider.present?... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/main_controller.rb | app/controllers/settings/main_controller.rb | # frozen_string_literal: true
class Settings::MainController < Settings::BaseController
include ActiveSupport::NumberHelper
before_action :authorize
def show
@title = "Settings"
render inertia: "Settings/Main/Show", props: settings_presenter.main_props
end
def update
current_seller.with_lock {... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/advanced_controller.rb | app/controllers/settings/advanced_controller.rb | # frozen_string_literal: true
class Settings::AdvancedController < Settings::BaseController
before_action :authorize
def show
@title = "Settings"
render inertia: "Settings/Advanced/Show", props: settings_presenter.advanced_props
end
def update
begin
BlockedCustomerObject.transaction do
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/payments_controller.rb | app/controllers/settings/payments_controller.rb | # frozen_string_literal: true
class Settings::PaymentsController < Settings::BaseController
include ActionView::Helpers::SanitizeHelper
before_action :authorize
def show
@title = "Settings"
render inertia: "Settings/Payments/Show", props: settings_presenter.payments_props(remote_ip: request.remote_ip)... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/stripe_controller.rb | app/controllers/settings/stripe_controller.rb | # frozen_string_literal: true
class Settings::StripeController < Sellers::BaseController
before_action :authenticate_user!, only: [:disconnect]
def disconnect
authorize [:settings, :payments, logged_in_user], :stripe_connect?
render json: { success: StripeMerchantAccountManager.disconnect(user: logged_in... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/dismiss_ai_product_generation_promos_controller.rb | app/controllers/settings/dismiss_ai_product_generation_promos_controller.rb | # frozen_string_literal: true
class Settings::DismissAiProductGenerationPromosController < Sellers::BaseController
before_action :authenticate_user!
after_action :verify_authorized
def create
authorize current_seller, :generate_product_details_with_ai?
current_seller.update!(dismissed_create_products_w... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/team_controller.rb | app/controllers/settings/team_controller.rb | # frozen_string_literal: true
class Settings::TeamController < Settings::BaseController
before_action :authorize
before_action :check_email_presence
def show
@title = "Team"
team_presenter = Settings::TeamPresenter.new(pundit_user:)
render inertia: "Settings/Team/Show", props: {
member_infos:... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/base_controller.rb | app/controllers/settings/base_controller.rb | # frozen_string_literal: true
class Settings::BaseController < Sellers::BaseController
layout "inertia"
inertia_share do
{
settings_pages: -> { settings_presenter.pages }
}
end
protected
def settings_presenter
@settings_presenter ||= SettingsPresenter.new(pundit_user:)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/profile_controller.rb | app/controllers/settings/profile_controller.rb | # frozen_string_literal: true
class Settings::ProfileController < Settings::BaseController
before_action :authorize
def show
@title = "Settings"
profile_presenter = ProfilePresenter.new(pundit_user:, seller: current_seller)
render inertia: "Settings/Profile/Show", props: settings_presenter.profile_pr... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/third_party_analytics_controller.rb | app/controllers/settings/third_party_analytics_controller.rb | # frozen_string_literal: true
class Settings::ThirdPartyAnalyticsController < Settings::BaseController
before_action :authorize
def show
@title = "Settings"
render inertia: "Settings/ThirdPartyAnalytics/Show", props: {
third_party_analytics: settings_presenter.third_party_analytics_props,
pro... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/authorized_applications_controller.rb | app/controllers/settings/authorized_applications_controller.rb | # frozen_string_literal: true
class Settings::AuthorizedApplicationsController < Settings::BaseController
def index
authorize([:settings, :authorized_applications, OauthApplication])
@title = "Settings"
render inertia: "Settings/AuthorizedApplications/Index", props: settings_presenter.authorized_applica... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/team/members_controller.rb | app/controllers/settings/team/members_controller.rb | # frozen_string_literal: true
class Settings::Team::MembersController < Sellers::BaseController
before_action :set_team_membership, only: %i[update destroy restore]
def index
authorize [:settings, :team, current_seller], :show?
@team_presenter = Settings::TeamPresenter.new(pundit_user:)
render json: ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/team/invitations_controller.rb | app/controllers/settings/team/invitations_controller.rb | # frozen_string_literal: true
class Settings::Team::InvitationsController < Sellers::BaseController
before_action :set_team_invitation, only: %i[update destroy restore resend_invitation]
def create
authorize [:settings, :team, TeamInvitation]
team_invitation = current_seller.team_invitations.new(create_p... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/settings/profile/products_controller.rb | app/controllers/settings/profile/products_controller.rb | # frozen_string_literal: true
class Settings::Profile::ProductsController < ApplicationController
def show
product = current_seller.products.find_by_external_id!(params[:id])
authorize product
# Avoid passing the pundit_user so that the product renders as non-editable
render json: ProductPresenter.n... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/stripe/setup_intents_controller.rb | app/controllers/stripe/setup_intents_controller.rb | # frozen_string_literal: true
# Stateless API calls we need to make for the frontend to setup future charges for given CC, before passing this
# CC data to be saved/charged along with the preorder, subscription, or bundle payment.
class Stripe::SetupIntentsController < ApplicationController
before_action :validate_c... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/suspend_users_controller.rb | app/controllers/admin/suspend_users_controller.rb | # frozen_string_literal: true
class Admin::SuspendUsersController < Admin::BaseController
# IDs can be separated by whitespaces or commas
ID_DELIMITER_REGEX = /\s|,/
SUSPEND_REASONS = [
"Violating our terms of service",
"Creating products that violate our ToS",
"Using Gumroad to commit fraud",
"U... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/block_email_domains_controller.rb | app/controllers/admin/block_email_domains_controller.rb | # frozen_string_literal: true
class Admin::BlockEmailDomainsController < Admin::BaseController
include MassBlocker
def show
@title = "Mass-block email domains"
render inertia: "Admin/BlockEmailDomains/Show"
end
def update
schedule_mass_block(identifiers: email_domains_params[:identifiers], object... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/unblock_email_domains_controller.rb | app/controllers/admin/unblock_email_domains_controller.rb | # frozen_string_literal: true
class Admin::UnblockEmailDomainsController < Admin::BaseController
include MassUnblocker
def show
@title = "Mass-unblock email domains"
render inertia: "Admin/UnblockEmailDomains/Show"
end
def update
schedule_mass_unblock(identifiers: email_domains_params[:identifier... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/merchant_accounts_controller.rb | app/controllers/admin/merchant_accounts_controller.rb | # frozen_string_literal: true
class Admin::MerchantAccountsController < Admin::BaseController
def show
if !MerchantAccount.external_id?(params[:external_id]) && merchant_account = MerchantAccount.find_by(id: params[:external_id])
return redirect_to admin_merchant_account_path(merchant_account.external_id)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/links_controller.rb | app/controllers/admin/links_controller.rb | # frozen_string_literal: true
class Admin::LinksController < Admin::BaseController
before_action :fetch_product!, except: :show
def show
if !Link.external_id?(params[:external_id]) && product = Link.find_by(id: params[:external_id])
return redirect_to admin_product_path(product.external_id)
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/paydays_controller.rb | app/controllers/admin/paydays_controller.rb | # frozen_string_literal: true
class Admin::PaydaysController < Admin::BaseController
# Pay the seller for all their balances up to and including `params[:payout_period_end_date]`.
def pay_user
user = User.find(params[:id])
date = Date.parse(payday_params[:payout_period_end_date])
payout_processor_type... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/purchases_controller.rb | app/controllers/admin/purchases_controller.rb | # frozen_string_literal: true
class Admin::PurchasesController < Admin::BaseController
before_action :fetch_purchase, only: %i[cancel_subscription refund refund_for_fraud refund_taxes_only resend_receipt
show sync_status_with_charge_processor block_buyer unblock_buyer undele... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/dashboard_controller.rb | app/controllers/admin/dashboard_controller.rb | # frozen_string_literal: true
class Admin::DashboardController < Admin::BaseController
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/affiliates_controller.rb | app/controllers/admin/affiliates_controller.rb | # frozen_string_literal: true
class Admin::AffiliatesController < Admin::BaseController
include Pagy::Backend
include Admin::ListPaginatedUsers
before_action :fetch_affiliate, only: [:show]
before_action :clean_search_query, only: [:index]
before_action :fetch_users_from_query, only: [:index]
helper Pagy... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/users_controller.rb | app/controllers/admin/users_controller.rb | # frozen_string_literal: true
class Admin::UsersController < Admin::BaseController
include Admin::FetchUser
include MassTransferPurchases
skip_before_action :require_admin!, if: :request_from_iffy?, only: %i[suspend_for_fraud_from_iffy mark_compliant_from_iffy flag_for_explicit_nsfw_tos_violation_from_iffy]
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/refund_queues_controller.rb | app/controllers/admin/refund_queues_controller.rb | # frozen_string_literal: true
class Admin::RefundQueuesController < Admin::BaseController
include Admin::ListPaginatedUsers
def show
@title = "Refund queue"
@users = User.refund_queue
list_paginated_users users: @users,
template: "Admin/RefundQueues/Show",
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/helper_actions_controller.rb | app/controllers/admin/helper_actions_controller.rb | # frozen_string_literal: true
module Admin
class HelperActionsController < BaseController
before_action :load_user
def impersonate
redirect_to admin_impersonate_path(user_identifier: @user.external_id)
end
def stripe_dashboard
merchant_account = @user.merchant_accounts.alive.stripe.firs... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/comments_controller.rb | app/controllers/admin/comments_controller.rb | # frozen_string_literal: true
class Admin::CommentsController < Admin::BaseController
skip_before_action :require_admin!, if: :request_from_iffy?
def create
Comment.create!(comment_params)
render json: { success: true }
end
private
def comment_params
permitted_params = params.require(:comm... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/action_call_dashboard_controller.rb | app/controllers/admin/action_call_dashboard_controller.rb | # frozen_string_literal: true
class Admin::ActionCallDashboardController < Admin::BaseController
def index
@title = "Action Call Dashboard"
@admin_action_call_infos = AdminActionCallInfo.order(call_count: :desc, controller_name: :asc, action_name: :asc)
render inertia: "Admin/ActionCallDashboard/Index",... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/base_controller.rb | app/controllers/admin/base_controller.rb | # frozen_string_literal: true
class Admin::BaseController < ApplicationController
include ActionView::Helpers::DateHelper, ActionView::Helpers::NumberHelper, AdminActionTracker, Impersonate
layout "admin"
inertia_share do
{
card_types: CreditCardUtility.card_types_for_react,
compliance: {
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/guids_controller.rb | app/controllers/admin/guids_controller.rb | # frozen_string_literal: true
class Admin::GuidsController < Admin::BaseController
include Admin::ListPaginatedUsers
def show
guid = params[:id]
@title = guid
@users = User.where(id: Event.by_browser_guid(guid).distinct.pluck(:user_id))
list_paginated_users users: @users,
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/sales_reports_controller.rb | app/controllers/admin/sales_reports_controller.rb | # frozen_string_literal: true
class Admin::SalesReportsController < Admin::BaseController
def index
@title = "Sales reports"
render inertia: "Admin/SalesReports/Index", props: {
countries: Compliance::Countries.for_select.map { |alpha2, name| [name, alpha2] },
sales_types: GenerateSalesReportJob... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/payouts_controller.rb | app/controllers/admin/payouts_controller.rb | # frozen_string_literal: true
class Admin::PayoutsController < Admin::BaseController
before_action :fetch_payment, only: %i[show retry cancel fail sync]
def show
@title = "Payout"
render inertia: "Admin/Payouts/Show",
props: { payout: Admin::PaymentPresenter.new(payment: @payment).props }
en... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/unreviewed_users_controller.rb | app/controllers/admin/unreviewed_users_controller.rb | # frozen_string_literal: true
class Admin::UnreviewedUsersController < Admin::BaseController
def index
@title = "Unreviewed users"
cached_data = Admin::UnreviewedUsersService.cached_users_data
if cached_data.blank?
render inertia: "Admin/UnreviewedUsers/Index",
props: {
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/search_controller.rb | app/controllers/admin/search_controller.rb | # frozen_string_literal: true
class Admin::SearchController < Admin::BaseController
before_action :clean_search_query
RECORDS_PER_PAGE = 25
private_constant :RECORDS_PER_PAGE
def users
@title = "User results"
@users = User.where(email: @raw_query).order("created_at DESC").limit(25) if EmailFormatVal... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/purchases/comments_controller.rb | app/controllers/admin/purchases/comments_controller.rb | # frozen_string_literal: true
class Admin::Purchases::CommentsController < Admin::BaseController
include Admin::Commentable
private
def commentable
Purchase.find_by_external_id!(params[:purchase_external_id])
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/affiliates/products_controller.rb | app/controllers/admin/affiliates/products_controller.rb | # frozen_string_literal: true
class Admin::Affiliates::ProductsController < Admin::Affiliates::BaseController
include Admin::Users::ListPaginatedProducts
def index
@title = "#{@affiliate_user.display_name} products on Gumroad"
list_paginated_products user: @affiliate_user,
pro... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/affiliates/base_controller.rb | app/controllers/admin/affiliates/base_controller.rb | # frozen_string_literal: true
class Admin::Affiliates::BaseController < Admin::BaseController
before_action :set_affiliate_user
private
def set_affiliate_user
@affiliate_user = User.find(params[:affiliate_id])
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/affiliates/products/purchases_controller.rb | app/controllers/admin/affiliates/products/purchases_controller.rb | # frozen_string_literal: true
class Admin::Affiliates::Products::PurchasesController < Admin::Affiliates::Products::BaseController
include Pagy::Backend
def index
scope = @product.sales.for_affiliate_user(@affiliate_user)
pagination, purchases = pagy_countless(
scope.for_admin_listing.includes(:sub... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/affiliates/products/base_controller.rb | app/controllers/admin/affiliates/products/base_controller.rb | # frozen_string_literal: true
class Admin::Affiliates::Products::BaseController < Admin::Affiliates::BaseController
before_action :set_product
private
def set_product
@product = Link.find_by_external_id!(params[:product_external_id])
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/compliance/cards_controller.rb | app/controllers/admin/compliance/cards_controller.rb | # frozen_string_literal: true
class Admin::Compliance::CardsController < Admin::BaseController
def refund
if params[:stripe_fingerprint].blank?
render json: { success: false }
else
purchases = Purchase.not_chargedback_or_chargedback_reversed.paid.where(stripe_fingerprint: params[:stripe_fingerpri... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/products/purchases_controller.rb | app/controllers/admin/products/purchases_controller.rb | # frozen_string_literal: true
class Admin::Products::PurchasesController < Admin::Products::BaseController
include Pagy::Backend
def index
pagination, purchases = pagy_countless(
@product.sales.for_admin_listing.includes(:subscription, :price, :refunds),
limit: params[:per_page],
page: param... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/products/comments_controller.rb | app/controllers/admin/products/comments_controller.rb | # frozen_string_literal: true
class Admin::Products::CommentsController < Admin::Products::BaseController
include Admin::Commentable
private
def commentable
@product
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/products/base_controller.rb | app/controllers/admin/products/base_controller.rb | # frozen_string_literal: true
class Admin::Products::BaseController < Admin::BaseController
before_action :set_product
private
def set_product
@product = Link.find_by_external_id!(params[:product_external_id])
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/products/staff_picked_controller.rb | app/controllers/admin/products/staff_picked_controller.rb | # frozen_string_literal: true
class Admin::Products::StaffPickedController < Admin::Products::BaseController
include AfterCommitEverywhere
def create
authorize [:admin, :products, :staff_picked, @product]
staff_picked_product = @product.staff_picked_product || @product.build_staff_picked_product
staf... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/products/details_controller.rb | app/controllers/admin/products/details_controller.rb | # frozen_string_literal: true
class Admin::Products::DetailsController < Admin::Products::BaseController
def show
if @product.filegroup
render json: { details: ProductPresenter.new(product: @product).admin_info }
else
render json: { details: nil }
end
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/products/infos_controller.rb | app/controllers/admin/products/infos_controller.rb | # frozen_string_literal: true
class Admin::Products::InfosController < Admin::Products::BaseController
def show
render json: { info: @product.as_json(admin_info: true) }
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/users/email_changes_controller.rb | app/controllers/admin/users/email_changes_controller.rb | # frozen_string_literal: true
class Admin::Users::EmailChangesController < Admin::Users::BaseController
before_action :fetch_user
def index
render json: {
email_changes: @user.versions_for(:email, :payment_address),
fields: %w(email payment_address)
}
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/users/merchant_accounts_controller.rb | app/controllers/admin/users/merchant_accounts_controller.rb | # frozen_string_literal: true
class Admin::Users::MerchantAccountsController < Admin::Users::BaseController
before_action :fetch_user
def index
render json: {
merchant_accounts: @user.merchant_accounts.as_json(only: %i[charge_processor_id], methods: %i[external_id alive charge_processor_alive]),
h... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/users/stats_controller.rb | app/controllers/admin/users/stats_controller.rb | # frozen_string_literal: true
class Admin::Users::StatsController < Admin::Users::BaseController
include CurrencyHelper
before_action :fetch_user
def index
render json: {
total: formatted_dollar_amount(@user.sales_cents_total),
balance: @user.balance_formatted,
chargeback_volume: @user.lo... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/users/products_controller.rb | app/controllers/admin/users/products_controller.rb | # frozen_string_literal: true
class Admin::Users::ProductsController < Admin::Users::BaseController
include Admin::Users::ListPaginatedProducts
before_action :fetch_user
def index
@title = "#{@user.display_name} products on Gumroad"
list_paginated_products user: @user,
prod... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/users/comments_controller.rb | app/controllers/admin/users/comments_controller.rb | # frozen_string_literal: true
class Admin::Users::CommentsController < Admin::Users::BaseController
include Admin::Commentable
before_action :fetch_user
private
def commentable
@user
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/users/base_controller.rb | app/controllers/admin/users/base_controller.rb | # frozen_string_literal: true
class Admin::Users::BaseController < Admin::BaseController
include Admin::FetchUser
protected
def user_param
params[:user_id]
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/controllers/admin/users/guids_controller.rb | app/controllers/admin/users/guids_controller.rb | # frozen_string_literal: true
class Admin::Users::GuidsController < Admin::Users::BaseController
def index
guids = Event.where(user_id: user_param).distinct.pluck(:browser_guid)
guids_to_users = Event.select(:user_id, :browser_guid).by_browser_guid(guids).
where.not(user_id: nil).d... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.