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/presenters/admin/unreviewed_user_presenter.rb | app/presenters/admin/unreviewed_user_presenter.rb | # frozen_string_literal: true
class Admin::UnreviewedUserPresenter
include Rails.application.routes.url_helpers
attr_reader :user
def initialize(user)
@user = user
end
def props
{
id: user.id,
external_id: user.external_id,
name: user.display_name,
email: user.email,
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/admin/payment_presenter.rb | app/presenters/admin/payment_presenter.rb | # frozen_string_literal: true
class Admin::PaymentPresenter
attr_reader :payment
def initialize(payment:)
@payment = payment
end
def props
{
id: payment.id,
displayed_amount: payment.displayed_amount,
payout_period_end_date: payment.payout_period_end_date,
created_at: payment.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/admin/purchase_presenter.rb | app/presenters/admin/purchase_presenter.rb | # frozen_string_literal: true
class Admin::PurchasePresenter
attr_reader :purchase
def initialize(purchase)
@purchase = purchase
end
def list_props
{
external_id: purchase.external_id,
formatted_display_price: purchase.formatted_display_price,
formatted_gumroad_tax_amount: purchase.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/admin/merchant_account_presenter.rb | app/presenters/admin/merchant_account_presenter.rb | # frozen_string_literal: true
class Admin::MerchantAccountPresenter
attr_reader :merchant_account
def initialize(merchant_account:)
@merchant_account = merchant_account
end
def props
{
charge_processor_id: merchant_account.charge_processor_id,
charge_processor_merchant_id: merchant_accoun... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/admin/user_presenter/card.rb | app/presenters/admin/user_presenter/card.rb | # frozen_string_literal: true
class Admin::UserPresenter::Card
attr_reader :user, :pundit_user
def initialize(user:, pundit_user:)
@user = user
@pundit_user = pundit_user
end
def props
{
impersonatable: Admin::Impersonators::UserPolicy.new(pundit_user, user).create?,
# Identification... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/admin/product_presenter/card.rb | app/presenters/admin/product_presenter/card.rb | # frozen_string_literal: true
class Admin::ProductPresenter::Card
attr_reader :product, :pundit_user
def initialize(product:, pundit_user:)
@product = product
@pundit_user = pundit_user
end
def props
link_policy = Admin::Products::StaffPicked::LinkPolicy.new(pundit_user, product)
{
exte... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/admin/product_presenter/multiple_matches.rb | app/presenters/admin/product_presenter/multiple_matches.rb | # frozen_string_literal: true
class Admin::ProductPresenter::MultipleMatches
attr_reader :product
def initialize(product:)
@product = product
end
def props
{
external_id: product.external_id,
name: product.name,
created_at: product.created_at,
long_url: product.long_url,
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/invoice_presenter/form_info.rb | app/presenters/invoice_presenter/form_info.rb | # frozen_string_literal: true
class InvoicePresenter::FormInfo
def initialize(chargeable)
@chargeable = chargeable
end
def heading
chargeable.is_direct_to_australian_customer? ? "Generate receipt" : "Generate invoice"
end
def display_vat_id?
chargeable.taxed_by_gumroad? && !chargeable.purchase_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/invoice_presenter/order_info.rb | app/presenters/invoice_presenter/order_info.rb | # frozen_string_literal: true
class InvoicePresenter::OrderInfo
include ActionView::Helpers::TextHelper
include CurrencyHelper
attr_reader :charge_info
def initialize(chargeable, address_fields:, additional_notes:, business_vat_id:)
@chargeable = chargeable
@address_fields = address_fields
@addit... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/invoice_presenter/supplier_info.rb | app/presenters/invoice_presenter/supplier_info.rb | # frozen_string_literal: true
class InvoicePresenter::SupplierInfo
include ActionView::Helpers::TextHelper
def initialize(chargeable)
@chargeable = chargeable
@seller = chargeable.seller
end
def heading
"Supplier"
end
def attributes
gumroad_attributes
end
private
attr_reader :ch... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/invoice_presenter/seller_info.rb | app/presenters/invoice_presenter/seller_info.rb | # frozen_string_literal: true
class InvoicePresenter::SellerInfo
include ActionView::Helpers::TextHelper
def initialize(chargeable)
@chargeable = chargeable
@seller = chargeable.seller
end
def heading
"Creator"
end
def attributes
seller_attributes
end
private
attr_reader :charge... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/checkout/discounts_presenter.rb | app/presenters/checkout/discounts_presenter.rb | # frozen_string_literal: true
class Checkout::DiscountsPresenter
include CheckoutDashboardHelper
BLACK_FRIDAY_CODE_NAME = "Black Friday 2025"
attr_reader :pundit_user, :offer_codes, :pagination
def initialize(pundit_user:, offer_codes: [], pagination: nil)
@pundit_user = pundit_user
@offer_codes = o... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/checkout/form_presenter.rb | app/presenters/checkout/form_presenter.rb | # frozen_string_literal: true
class Checkout::FormPresenter
include CheckoutDashboardHelper
attr_reader :pundit_user
def initialize(pundit_user:)
@pundit_user = pundit_user
end
def form_props
seller = pundit_user.seller
products = seller.products.visible.order(created_at: :desc).to_a
cart_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/checkout/upsells_presenter.rb | app/presenters/checkout/upsells_presenter.rb | # frozen_string_literal: true
class Checkout::UpsellsPresenter
include CheckoutDashboardHelper
attr_reader :pundit_user, :upsells, :pagination
def initialize(pundit_user:, upsells:, pagination:)
@pundit_user = pundit_user
@upsells = upsells
@pagination = pagination
end
def upsells_props
{
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/checkout/upsells/product_presenter.rb | app/presenters/checkout/upsells/product_presenter.rb | # frozen_string_literal: true
class Checkout::Upsells::ProductPresenter
def initialize(product)
@product = product
end
def product_props
{
id: product.external_id,
permalink: product.unique_permalink,
name: product.name,
price_cents: product.price_cents,
currency_code: prod... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/discover/autocomplete_presenter.rb | app/presenters/discover/autocomplete_presenter.rb | # frozen_string_literal: true
class Discover::AutocompletePresenter
RECENT_SEARCH_LIMIT = 100
PRODUCT_RESULT_COUNT = 5
def initialize(query:, user:, browser_guid:)
@query = query.to_s.downcase
@user = user
@browser_guid = browser_guid
end
def props
{ recent_searches: }.merge(product_results... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/discover/tag_page_meta_presenter.rb | app/presenters/discover/tag_page_meta_presenter.rb | # frozen_string_literal: true
class Discover::TagPageMetaPresenter
include ActionView::Helpers::NumberHelper
attr_reader :tags, :result_count
def initialize(tags, result_count)
@tags = tags
@result_count = result_count
end
def title
default_tag_title = fetch_discover_meta("titles.default", tag... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/discover/taxonomy_presenter.rb | app/presenters/discover/taxonomy_presenter.rb | # frozen_string_literal: true
class Discover::TaxonomyPresenter
TAXONOMY_LABELS = {
"3d" => "3D",
"3d-assets" => "3D Assets",
"3d-icons" => "3D Icons",
"3d-modeling" => "3D Modeling",
"3d-printing" => "3D Printing",
"3dsmax" => "3ds Max",
"ableton-live" => "Ableton Live",
"accessories... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/discover/canonical_url_presenter.rb | app/presenters/discover/canonical_url_presenter.rb | # frozen_string_literal: true
class Discover::CanonicalUrlPresenter
def self.canonical_url(params)
if params.values_at(:taxonomy, :query, :tags).all?(&:blank?)
return UrlService.discover_full_path("/")
end
path = params[:taxonomy] || "/"
valid_canonical_params = params.permit(:sort, :query, :m... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/product_presenter/card.rb | app/presenters/product_presenter/card.rb | # frozen_string_literal: true
class ProductPresenter::Card
include Rails.application.routes.url_helpers
include ProductsHelper
ASSOCIATIONS = [
:alive_prices, :product_review_stat, :tiers, :variant_categories_alive,
{
user: [:avatar_attachment, :avatar_blob],
thumbnail_alive: { file_attachme... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/product_presenter/installment_plan_props.rb | app/presenters/product_presenter/installment_plan_props.rb | # frozen_string_literal: true
class ProductPresenter::InstallmentPlanProps
attr_reader :product, :installment_plan
def initialize(product:)
@product = product
@installment_plan = product.installment_plan
end
def props
{
eligible_for_installment_plans: product.eligible_for_installment_plans?... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/product_presenter/product_props.rb | app/presenters/product_presenter/product_props.rb | # frozen_string_literal: true
class ProductPresenter::ProductProps
include Rails.application.routes.url_helpers
include ProductsHelper
SALES_COUNT_CACHE_KEY_REFIX = "product-presenter:sales-count-cache"
SALES_COUNT_CACHE_METRICS_KEY = "#{SALES_COUNT_CACHE_KEY_REFIX}-metrics"
def initialize(product:)
@p... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/receipt_presenter/recommended_products_info.rb | app/presenters/receipt_presenter/recommended_products_info.rb | # frozen_string_literal: true
class ReceiptPresenter::RecommendedProductsInfo
# It should match the value from ApplicationController#set_recommender_model_name
MODEL = RecommendedProductsService::MODELS.sample
def initialize(chargeable)
@chargeable = chargeable
@purchaser = chargeable.purchaser
end
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/receipt_presenter/shipping_info.rb | app/presenters/receipt_presenter/shipping_info.rb | # frozen_string_literal: true
class ReceiptPresenter::ShippingInfo
include ActionView::Helpers::TextHelper
include CurrencyHelper
def initialize(chargeable)
@chargeable = chargeable
end
def title
"Shipping info"
end
def attributes
return [] unless chargeable.require_shipping?
[
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/receipt_presenter/charge_info.rb | app/presenters/receipt_presenter/charge_info.rb | # frozen_string_literal: true
class ReceiptPresenter::ChargeInfo
include ActionView::Helpers::UrlHelper
include CurrencyHelper
include MailerHelper
include ERB::Util
def initialize(chargeable, for_email:, order_items_count:)
@for_email = for_email
@order_items_count = order_items_count
@chargeab... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/receipt_presenter/payment_info.rb | app/presenters/receipt_presenter/payment_info.rb | # frozen_string_literal: true
class ReceiptPresenter::PaymentInfo
include ActionView::Helpers::UrlHelper
include CurrencyHelper
def initialize(chargeable)
@chargeable = chargeable
@orderable = chargeable.orderable
end
def present?
today_payment_attributes.present? || upcoming_payment_attributes... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/receipt_presenter/giftee_manage_subscription.rb | app/presenters/receipt_presenter/giftee_manage_subscription.rb | # frozen_string_literal: true
class ReceiptPresenter::GifteeManageSubscription
include ActionView::Helpers::UrlHelper
include BasePrice::Recurrence
def initialize(chargeable)
@chargeable = chargeable
end
def note
@_note ||= begin
return unless gifted_subscription?
# Get the subscriptio... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/receipt_presenter/mail_subject.rb | app/presenters/receipt_presenter/mail_subject.rb | # frozen_string_literal: true
class ReceiptPresenter::MailSubject
PRODUCT_NAME_CHARACTER_LIMIT = 27
def self.build(chargeable)
new(chargeable).build
end
def initialize(chargeable)
@chargeable = chargeable
@purchases = chargeable.unbundled_purchases
end
def build
if purchases.one?
b... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/receipt_presenter/item_info.rb | app/presenters/receipt_presenter/item_info.rb | # frozen_string_literal: true
class ReceiptPresenter::ItemInfo
include ActionView::Helpers::TextHelper
include ActionView::Helpers::UrlHelper
include CurrencyHelper
include PreorderHelper
include ProductsHelper
include BasePrice::Recurrence
attr_reader :product, :purchase
def initialize(purchase)
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/receipt_presenter/footer_info.rb | app/presenters/receipt_presenter/footer_info.rb | # frozen_string_literal: true
class ReceiptPresenter::FooterInfo
include ActionView::Helpers::UrlHelper
include MailerHelper
include BasePrice::Recurrence
def initialize(chargeable)
@chargeable = chargeable
end
def can_manage_subscription?
return false unless chargeable.is_a?(Purchase) && chargea... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/presenters/post/social_image.rb | app/presenters/post/social_image.rb | # frozen_string_literal: true
class Post::SocialImage
class << self
alias_method :for, :new
end
def initialize(content)
@content = content
end
def url
first_figure_with_image&.at("img")&.attr("src")
end
def caption
first_figure_with_image&.at(".figcaption")&.text
end
def blank?
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/affiliates_helper.rb | app/helpers/affiliates_helper.rb | # frozen_string_literal: true
module AffiliatesHelper
def affiliate_products_select_data(affiliate, products)
tag_ids = products.each_with_object([]) do |product, selected|
selected << product.external_id if affiliate.products.exists? && affiliate.products.include?(product)
end
tag_list = products.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/social_share_url_helper.rb | app/helpers/social_share_url_helper.rb | # frozen_string_literal: true
module SocialShareUrlHelper
def twitter_url(url, text)
"https://twitter.com/intent/tweet?text=#{CGI.escape(text)}:%20#{url}"
end
def facebook_url(url, text = nil)
share_url = "https://www.facebook.com/sharer/sharer.php?u=#{url}"
share_url += ""e=#{CGI.escape(text)}"... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/products_helper.rb | app/helpers/products_helper.rb | # frozen_string_literal: true
module ProductsHelper
include TwitterCards
include CdnUrlHelper
include Pagy::Backend
include CustomDomainConfig
def files_data(product)
product.product_files.alive.in_order.includes(:alive_subtitle_files).map(&:as_json)
end
def file_specific_attributes(product)
{
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/card_params_helper.rb | app/helpers/card_params_helper.rb | # frozen_string_literal: true
module CardParamsHelper
module_function
# Public: Gets the card data handling mode that's indicated in the card parameters.
# params - the params received containing posted data and the card_data_handling_mode parameter
# Returns: a string indicating the card data handling mode or... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/preorder_helper.rb | app/helpers/preorder_helper.rb | # frozen_string_literal: true
module PreorderHelper
def displayable_release_at_date(release_at, seller_timezone)
release_at_seller_time = release_at_seller_time(release_at, seller_timezone)
release_at_seller_time.to_fs(:formatted_date_full_month)
end
def displayable_release_at_time(release_at, seller_ti... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/payouts_helper.rb | app/helpers/payouts_helper.rb | # frozen_string_literal: true
module PayoutsHelper
include CurrencyHelper
# Payments before this date don't have balances associated with them (pre rolling payouts)
OLDEST_DISPLAYABLE_PAYOUT_PERIOD_END_DATE = Date.parse("2013-01-04")
def formatted_payout_date(payout_date)
return "" if payout_date.nil?
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/mailer_helper.rb | app/helpers/mailer_helper.rb | # frozen_string_literal: true
module MailerHelper
# This regex matches all non-ASCII characters from the Latin script
EXTENDED_LATIN_REGEX = /[\p{InLatin-1_Supplement}|\p{InLatin_Extended-A}|\p{InLatin_Extended-B}]/
# This regex matches if there is a non-ASCII character from the Latin script AND a symbol
EXTEN... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/users_helper.rb | app/helpers/users_helper.rb | # frozen_string_literal: true
module UsersHelper
def allowed_avatar_extensions
User::ALLOWED_AVATAR_EXTENSIONS.map { |extension| ".#{extension}" }.join(",")
end
def is_third_party_analytics_enabled?(seller:, logged_in_seller:)
seller ||= user_signed_in? && logged_in_seller
# Third-party analytics se... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/checkout_dashboard_helper.rb | app/helpers/checkout_dashboard_helper.rb | # frozen_string_literal: true
module CheckoutDashboardHelper
def pages
["discounts", "form", "upsells"]
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/installments_helper.rb | app/helpers/installments_helper.rb | # frozen_string_literal: true
module InstallmentsHelper
def post_title_displayable(post:, url: nil)
return content_tag(:span, post.subject, class: "title") unless url.present?
link_to post.subject, url, target: "_blank", class: "title"
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/button_helper.rb | app/helpers/button_helper.rb | # frozen_string_literal: true
module ButtonHelper
# color options: "success" | "warning" | "info" | "danger" | "primary" | "accent" | "filled"
def navigation_button(body, url, options = {})
disabled = options.delete(:disabled)
color = options.delete(:color) || "accent"
class_names = options.delete(:cla... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/application_helper.rb | app/helpers/application_helper.rb | # frozen_string_literal: true
module ApplicationHelper
def load_pack(page)
render("shared/pack_setup", page:)
end
def s3_bucket_url
"#{AWS_S3_ENDPOINT}/#{S3_BUCKET}"
end
def default_footer_content
safe_join(
[
"Powered by",
tag.span("Gumroad", class: "logo-full", aria: { l... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/cdn_url_helper.rb | app/helpers/cdn_url_helper.rb | # frozen_string_literal: true
module CdnUrlHelper
def replace_s3_urls_with_cdn_urls(content)
return content if content.blank?
CDN_URL_MAP.each do |origin_regex, cdn_prefix|
content = content.gsub(origin_regex, cdn_prefix)
end
content
end
alias cdn_url_for replace_s3_urls_with_cdn_urls
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/infos_helper.rb | app/helpers/infos_helper.rb | # frozen_string_literal: true
module InfosHelper
include ActionView::Helpers::TextHelper
def duration_displayable(duration)
return nil if !duration || duration == 0
time = ""
if duration < 60
return time = (Time.mktime(0) + duration).strftime("0:%S")
elsif duration < 60 * 10
time = (Tim... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/installment_rule_helper.rb | app/helpers/installment_rule_helper.rb | # frozen_string_literal: true
module InstallmentRuleHelper
# Converts duration and period into seconds
#
# Examples
# convert_to_seconds(1, "HOUR")
# #=> 3600
# convert_to_seconds(7, "DAY")
# # => 604800
#
# Returns an integer
def convert_to_seconds(duration, period)
duration = duration... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/currency_helper.rb | app/helpers/currency_helper.rb | # frozen_string_literal: true
module CurrencyHelper
include BasePrice::Recurrence
# Note: To reference a currency in code, use Currency::[3-char-ref].
# e.g. Currency::USD, Currency::CAD
def currency_namespace
Redis::Namespace.new(:currencies, redis: $redis)
end
def symbol_for(type = :usd)
CURREN... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/admin_helper.rb | app/helpers/admin_helper.rb | # frozen_string_literal: true
module AdminHelper
include IconHelper
def purchase_refund_policy_tooltip(purchase_refund_policy)
return nil unless purchase_refund_policy.different_than_product_refund_policy?
title = purchase_refund_policy.product_refund_policy&.title || "None"
with_tooltip(tip: "Curre... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/signed_url_helper.rb | app/helpers/signed_url_helper.rb | # frozen_string_literal: true
module SignedUrlHelper
SIGNED_S3_URL_VALID_FOR_MINIMUM = 10.minutes
SIGNED_S3_URL_VALID_FOR_MAXIMUM = 3.hours
SIGNED_VIDEO_URL_VALID_FOR = 12.hours
# Warning: Changing the value of this will invalidate a lot of cached files in CloudFlare
CF_WORKER_CACHE_KEY = "caIWHGT4Qhqo6KoxD... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/icon_helper.rb | app/helpers/icon_helper.rb | # frozen_string_literal: true
module IconHelper
# For icon values see app/icons/images/icons folder
#
def icon(icon, options = {})
css_classes = ["icon", "icon-#{icon}", options[:class]]
tag.span(nil, **options.merge(class: css_classes))
end
def icon_yes
icon("solid-check-circle", aria: { label:... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/helpers/admin/purchase_helper.rb | app/helpers/admin/purchase_helper.rb | # frozen_string_literal: true
module Admin::PurchaseHelper
def purchase_states(purchase)
[
purchase.purchase_state.capitalize,
("(refunded)" if purchase.stripe_refunded?),
("(partially refunded)" if purchase.stripe_partially_refunded?),
("(chargeback)" if purchase.chargedback_not_reversed... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/product_review_video_policy.rb | app/policies/product_review_video_policy.rb | # frozen_string_literal: true
class ProductReviewVideoPolicy < ApplicationPolicy
def approve?
role_permitted? && owned_by_seller?(record)
end
def reject?
approve?
end
def stream?
return true if record.approved?
purchased_by_user?(record) || owned_by_seller?(record)
end
private
def ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/direct_affiliate_policy.rb | app/policies/direct_affiliate_policy.rb | # frozen_string_literal: true
class DirectAffiliatePolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def show?
index?
end
def create?
user.role_admin_for?(... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/commission_policy.rb | app/policies/commission_policy.rb | # frozen_string_literal: true
class CommissionPolicy < ApplicationPolicy
def update?
(user.role_admin_for?(seller) || user.role_support_for?(seller)) && record.deposit_purchase.seller == seller
end
def complete?
update?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/s3_utility_policy.rb | app/policies/s3_utility_policy.rb | # frozen_string_literal: true
# Products > Edit product
class S3UtilityPolicy < ApplicationPolicy
def generate_multipart_signature?
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller)
end
def current_utc_time_string?
generate_multipart_signature?
end
def cdn_url_for_blob?
gener... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/balance_policy.rb | app/policies/balance_policy.rb | # frozen_string_literal: true
class BalancePolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_support_for?(seller)
end
def export?
index?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/asset_preview_policy.rb | app/policies/asset_preview_policy.rb | # frozen_string_literal: true
# Products > Edit product
class AssetPreviewPolicy < ApplicationPolicy
def create?
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller)
end
def destroy?
create?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/installment_policy.rb | app/policies/installment_policy.rb | # frozen_string_literal: true
# Posts section
#
class InstallmentPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def create?
user.role_admin_for?(seller) ||
u... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/thumbnail_policy.rb | app/policies/thumbnail_policy.rb | # frozen_string_literal: true
# Products > Edit product
class ThumbnailPolicy < ApplicationPolicy
def create?
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller)
end
def destroy?
create?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/imported_customer_policy.rb | app/policies/imported_customer_policy.rb | # frozen_string_literal: true
# Audience > Customers
#
class ImportedCustomerPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def update?
# Actual purchase is not ... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/application_policy.rb | app/policies/application_policy.rb | # frozen_string_literal: true
class ApplicationPolicy
attr_reader :user, :seller, :record
class_attribute :allow_anonymous_user_access, default: false
class << self
def allow_anonymous_user_access!
self.allow_anonymous_user_access = true
end
end
def initialize(context, record)
@context =... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/product_review_policy.rb | app/policies/product_review_policy.rb | # frozen_string_literal: true
class ProductReviewPolicy < ApplicationPolicy
def index?
user.role_owner_for?(seller) && Feature.active?(:reviews_page, user)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/dashboard_policy.rb | app/policies/dashboard_policy.rb | # frozen_string_literal: true
class DashboardPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def customers_count? = index?
def total_revenue? = index?
def active_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/call_policy.rb | app/policies/call_policy.rb | # frozen_string_literal: true
class CallPolicy < ApplicationPolicy
def update?
(user.role_admin_for?(seller) || user.role_support_for?(seller)) && record.purchase.seller == seller
end
def permitted_attributes
[:call_url]
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/affiliate_request_policy.rb | app/policies/affiliate_request_policy.rb | # frozen_string_literal: true
class AffiliateRequestPolicy < ApplicationPolicy
def update?
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller)
end
def approve_all?
update?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/comment_context_policy.rb | app/policies/comment_context_policy.rb | # frozen_string_literal: true
# Does not inherit from ApplicationPolicy as this policy is used in a context where user is not authenticated,
# like CommentsController
# This is an exception from all other policies that are used within an authenticated area (where user and seller
# are set)
#
# Associated with Posts se... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/collaborator_policy.rb | app/policies/collaborator_policy.rb | # frozen_string_literal: true
class CollaboratorPolicy < ApplicationPolicy
def index?
user.role_admin_for?(seller)
end
def create?
index?
end
def new?
index?
end
def edit?
index? && when_record_available { record.seller == seller }
end
def update?
edit?
end
def destroy?
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/community_policy.rb | app/policies/community_policy.rb | # frozen_string_literal: true
class CommunityPolicy < ApplicationPolicy
def index?
user.accessible_communities_ids.any?
end
def show?
user.accessible_communities_ids.include?(record.id)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/purchase_policy.rb | app/policies/purchase_policy.rb | # frozen_string_literal: true
# Library section
#
class PurchasePolicy < ApplicationPolicy
def index?
user.role_owner_for?(seller)
end
def archive?
index?
end
def unarchive?
index?
end
def delete?
index?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/wishlist_follower_policy.rb | app/policies/wishlist_follower_policy.rb | # frozen_string_literal: true
class WishlistFollowerPolicy < ApplicationPolicy
def create?
user.role_owner_for?(seller)
end
def destroy?
create? && record.follower_user == user
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/dropbox_files_policy.rb | app/policies/dropbox_files_policy.rb | # frozen_string_literal: true
# Products > Edit product
class DropboxFilesPolicy < ApplicationPolicy
def create?
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller)
end
def index?
create?
end
def cancel_upload?
create?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/support_policy.rb | app/policies/support_policy.rb | # frozen_string_literal: true
class SupportPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/subscription_policy.rb | app/policies/subscription_policy.rb | # frozen_string_literal: true
# Audience > Customers
#
class SubscriptionPolicy < ApplicationPolicy
# Should match Audience::PurchasePolicy#update?
def unsubscribe_by_seller?
return false if record.link.user != seller
user.role_admin_for?(seller) ||
user.role_support_for?(seller)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/product_review_response_policy.rb | app/policies/product_review_response_policy.rb | # frozen_string_literal: true
class ProductReviewResponsePolicy < ApplicationPolicy
def update?
role_permitted? && owned_by_seller?
end
def destroy?
role_permitted? && owned_by_seller?
end
private
def role_permitted?
user.role_owner_for?(seller) ||
user.role_admin_for?(seller) ||
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/analytics_policy.rb | app/policies/analytics_policy.rb | # frozen_string_literal: true
class AnalyticsPolicy < ApplicationPolicy
def index?
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller) ||
user.role_accountant_for?(seller)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/profile_section_policy.rb | app/policies/profile_section_policy.rb | # frozen_string_literal: true
class ProfileSectionPolicy < ApplicationPolicy
def create? = update?
def update?
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller)
end
def destroy? = update?
def permitted_attributes_for_create
[:type, :product_id, *permitted_attributes_for_update]
... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/link_policy.rb | app/policies/link_policy.rb | # frozen_string_literal: true
# Products section
class LinkPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def new?
user.role_admin_for?(seller) ||
user.role_... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/seller_context.rb | app/policies/seller_context.rb | # frozen_string_literal: true
class SellerContext
attr_reader :user, :seller
# Special context when pundit_user is used in a context where the presenter works with user not being
# authenticated. Usually, this is because the presenter is used for both public and seller areas.
def self.logged_out
new(user:... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/utm_link_policy.rb | app/policies/utm_link_policy.rb | # frozen_string_literal: true
class UtmLinkPolicy < ApplicationPolicy
def index?
Feature.active?(:utm_links, seller) &&
(user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller) ||
user.role_accountant_for?(seller))
end
def create?
Feature.active... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/comment_context.rb | app/policies/comment_context.rb | # frozen_string_literal: true
class CommentContext
attr_reader :comment, :commentable, :purchase
def initialize(comment:, commentable:, purchase:)
@comment = comment
@commentable = commentable
@purchase = purchase
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/instant_payout_policy.rb | app/policies/instant_payout_policy.rb | # frozen_string_literal: true
class InstantPayoutPolicy < ApplicationPolicy
def create?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/service_charge_policy.rb | app/policies/service_charge_policy.rb | # frozen_string_literal: true
class ServiceChargePolicy < ApplicationPolicy
def create?
user.role_owner_for?(seller)
end
def confirm?
create?
end
def resend_receipt?
create?
end
def send_invoice?
create?
end
def generate_service_charge_invoice?
create?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/user_policy.rb | app/policies/user_policy.rb | # frozen_string_literal: true
# Settings / Main
class UserPolicy < ApplicationPolicy
def deactivate?
user.role_owner_for?(seller)
end
def generate_product_details_with_ai?
seller.eligible_for_ai_product_generation? && (user.is_team_member? || user.id == seller.id || user.role_admin_for?(seller) || user.... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/audience_policy.rb | app/policies/audience_policy.rb | # frozen_string_literal: true
class AudiencePolicy < ApplicationPolicy
def index?
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller) ||
user.role_accountant_for?(seller)
end
def export?
index?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/workflow_policy.rb | app/policies/workflow_policy.rb | # frozen_string_literal: true
# Associated with Posts section
#
class WorkflowPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def create?
user.role_admin_for?(sel... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/wishlist_product_policy.rb | app/policies/wishlist_product_policy.rb | # frozen_string_literal: true
class WishlistProductPolicy < ApplicationPolicy
def index?
user.role_owner_for?(seller)
end
def create?
index?
end
def destroy?
index? && record.wishlist.user == user
end
def permitted_attributes
[:product_id, :quantity, :rent, :recurrence, :option_id]
e... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/community_chat_message_policy.rb | app/policies/community_chat_message_policy.rb | # frozen_string_literal: true
class CommunityChatMessagePolicy < ApplicationPolicy
def update?
user.id == record.user_id
end
def destroy?
user.id == record.user_id || user.id == record.community.seller_id
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/collaborator_invitation_policy.rb | app/policies/collaborator_invitation_policy.rb | # frozen_string_literal: true
class CollaboratorInvitationPolicy < ApplicationPolicy
def accept?
user.role_admin_for?(seller) &&
record.collaborator.affiliate_user == seller
end
def decline?
accept?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/wishlist_policy.rb | app/policies/wishlist_policy.rb | # frozen_string_literal: true
class WishlistPolicy < ApplicationPolicy
def index?
user.role_owner_for?(seller)
end
def create?
index?
end
def update?
index? && record.user == user
end
def destroy?
index? && record.user == user
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/audience/purchase_policy.rb | app/policies/audience/purchase_policy.rb | # frozen_string_literal: true
class Audience::PurchasePolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def update?
user.role_admin_for?(seller) ||
user.role_su... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/audience/follower_policy.rb | app/policies/audience/follower_policy.rb | # frozen_string_literal: true
class Audience::FollowerPolicy < ApplicationPolicy
def index?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def update?
user.role_admin_for?(seller) ||
user.role_su... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/stripe_account_sessions/user_policy.rb | app/policies/stripe_account_sessions/user_policy.rb | # frozen_string_literal: true
class StripeAccountSessions::UserPolicy < ApplicationPolicy
def create?
user.role_owner_for?(seller) && record == seller
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/affiliate_requests/onboarding_form_policy.rb | app/policies/affiliate_requests/onboarding_form_policy.rb | # frozen_string_literal: true
class AffiliateRequests::OnboardingFormPolicy < ApplicationPolicy
def update?
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller)
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/settings/profile_policy.rb | app/policies/settings/profile_policy.rb | # frozen_string_literal: true
class Settings::ProfilePolicy < ApplicationPolicy
def show?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
def update?
user.role_admin_for?(seller) ||
user.role_mark... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/settings/payments/user_policy.rb | app/policies/settings/payments/user_policy.rb | # frozen_string_literal: true
class Settings::Payments::UserPolicy < ApplicationPolicy
def show?
user.role_admin_for?(seller)
end
def update?
user.role_owner_for?(seller) && record == seller
end
def set_country?
update?
end
def opt_in_to_au_backtax_collection?
update?
end
def veri... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/settings/advanced/user_policy.rb | app/policies/settings/advanced/user_policy.rb | # frozen_string_literal: true
class Settings::Advanced::UserPolicy < ApplicationPolicy
def show?
user.role_admin_for?(seller)
end
def update?
show?
end
def test_ping?
show?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/settings/password/user_policy.rb | app/policies/settings/password/user_policy.rb | # frozen_string_literal: true
class Settings::Password::UserPolicy < ApplicationPolicy
def show?
user.role_owner_for?(seller)
end
def update?
show?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/settings/team/team_invitation_policy.rb | app/policies/settings/team/team_invitation_policy.rb | # frozen_string_literal: true
class Settings::Team::TeamInvitationPolicy < ApplicationPolicy
def create?
user.role_admin_for?(seller)
end
def update?
create?
end
def destroy?
create?
end
def restore?
destroy?
end
def accept?
user.role_owner_for?(seller)
end
def resend_inv... | ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/settings/team/team_membership_policy.rb | app/policies/settings/team/team_membership_policy.rb | # frozen_string_literal: true
class Settings::Team::TeamMembershipPolicy < ApplicationPolicy
def update?
user.role_admin_for?(seller)
end
def destroy?
update? ||
user == record.user
end
def restore?
destroy?
end
end
| ruby | MIT | 638f6c3a40b23b907c09f6881d4df18339da069c | 2026-01-04T15:39:11.815677Z | false |
antiwork/gumroad | https://github.com/antiwork/gumroad/blob/638f6c3a40b23b907c09f6881d4df18339da069c/app/policies/settings/team/user_policy.rb | app/policies/settings/team/user_policy.rb | # frozen_string_literal: true
class Settings::Team::UserPolicy < ApplicationPolicy
def show?
user.role_accountant_for?(seller) ||
user.role_admin_for?(seller) ||
user.role_marketing_for?(seller) ||
user.role_support_for?(seller)
end
end
| 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.