Skip to content

Conversation

@NeonGamerBot-QK
Copy link
Member

@NeonGamerBot-QK NeonGamerBot-QK commented Jan 23, 2026

todo:

  • resolve all reports on the project
  • make sure payout doenst break the ship
  • improve the message

@NeonGamerBot-QK NeonGamerBot-QK linked an issue Jan 23, 2026 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds functionality to issue a minimum payout to users and send notification messages when shadow banning projects. The changes aim to ensure that users receive at least a minimum payout for their work even when their project is shadow banned, and to notify all project members about the shadow ban decision.

Changes:

  • Added logic to calculate and issue a minimum payout for the latest ship event if no payout exists
  • Added Slack DM notifications to all project members when a project is shadow banned
  • Updated the redirect notice to indicate when a minimum payout was issued

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

parts = []
parts << "Hey! After review, your project won't be going into voting this time."
parts << "Reason: #{reason}" if reason.present?
parts << "We issued a minimum payout for your work." if issued_min_payout
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message says "We issued a minimum payout for your work" which is misleading because it's only shown when a payout was issued. Consider changing it to be more specific about what happened, e.g., "We've issued a minimum payout of X cookies for your ship to recognize your effort."

Copilot uses AI. Check for mistakes.
Comment on lines 59 to 73
# Issue minimum payout if no payout exists for latest ship
ship = @project.ship_events.order(:created_at).last
issued_min_payout = false
if ship.present? && ship.payouts.none?
hours = ship.hours_covered
min_multiplier = 1.0
amount = (min_multiplier * hours).ceil
if amount > 0
Payout.create!(amount: amount, payable: ship, user: @project.user, reason: "Minimum payout (shadow banned)", escrowed: false)
issued_min_payout = true
end
end

@project.shadow_ban!(reason: reason)

Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The payout is created before the shadow ban is applied. If @project.shadow_ban! fails (line 72), the payout will have already been issued but the project won't be shadow banned. Consider wrapping the payout creation and shadow ban in a transaction, or move the payout creation to after the shadow ban succeeds.

Suggested change
# Issue minimum payout if no payout exists for latest ship
ship = @project.ship_events.order(:created_at).last
issued_min_payout = false
if ship.present? && ship.payouts.none?
hours = ship.hours_covered
min_multiplier = 1.0
amount = (min_multiplier * hours).ceil
if amount > 0
Payout.create!(amount: amount, payable: ship, user: @project.user, reason: "Minimum payout (shadow banned)", escrowed: false)
issued_min_payout = true
end
end
@project.shadow_ban!(reason: reason)
issued_min_payout = false
ActiveRecord::Base.transaction do
# Issue minimum payout if no payout exists for latest ship
ship = @project.ship_events.order(:created_at).last
if ship.present? && ship.payouts.none?
hours = ship.hours_covered
min_multiplier = 1.0
amount = (min_multiplier * hours).ceil
if amount > 0
Payout.create!(
amount: amount,
payable: ship,
user: @project.user,
reason: "Minimum payout (shadow banned)",
escrowed: false
)
issued_min_payout = true
end
end
@project.shadow_ban!(reason: reason)
end

Copilot uses AI. Check for mistakes.
Comment on lines 62 to 68
if ship.present? && ship.payouts.none?
hours = ship.hours_covered
min_multiplier = 1.0
amount = (min_multiplier * hours).ceil
if amount > 0
Payout.create!(amount: amount, payable: ship, user: @project.user, reason: "Minimum payout (shadow banned)", escrowed: false)
issued_min_payout = true
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Payout model does not exist in this codebase. The system uses LedgerEntry for all payouts. Following the pattern in app/services/ship_event_payout_calculator.rb:45-50, this should be:

payout_user = ship.payout_recipient
return unless payout_user

payout_user.ledger_entries.create!(
  ledgerable: ship,
  amount: amount,
  reason: "Minimum payout (shadow banned)",
  created_by: "admin:shadow_ban"
)

Note that @project.user doesn't exist (projects have multiple users), and the payout should go to the ship event's payout recipient (the user who created the ship post).

Suggested change
if ship.present? && ship.payouts.none?
hours = ship.hours_covered
min_multiplier = 1.0
amount = (min_multiplier * hours).ceil
if amount > 0
Payout.create!(amount: amount, payable: ship, user: @project.user, reason: "Minimum payout (shadow banned)", escrowed: false)
issued_min_payout = true
if ship.present? && !LedgerEntry.exists?(ledgerable: ship)
hours = ship.hours_covered
min_multiplier = 1.0
amount = (min_multiplier * hours).ceil
if amount > 0
payout_user = ship.payout_recipient
if payout_user
payout_user.ledger_entries.create!(
ledgerable: ship,
amount: amount,
reason: "Minimum payout (shadow banned)",
created_by: "admin:shadow_ban"
)
issued_min_payout = true
end

Copilot uses AI. Check for mistakes.
end
end

@project.shadow_ban!(reason: reason)
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the PR description TODO list, this feature should "resolve all reports on the project" when shadow banning, but there is no code to handle project reports. Consider adding code to mark all pending reports for this project as reviewed or dismissed, for example: @project.reports.where(status: :pending).update_all(status: :reviewed) after the shadow ban.

Copilot uses AI. Check for mistakes.
@cskartikey
Copy link
Member

pls have it go through to me when you're done

@NeonGamerBot-QK NeonGamerBot-QK marked this pull request as ready for review January 26, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shadow bans

3 participants