publishers icon indicating copy to clipboard operation
publishers copied to clipboard

Feat/migrate dashboard

Open jlbyrne opened this issue 11 months ago • 3 comments

jlbyrne avatar Mar 19 '24 13:03 jlbyrne

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

socket-security[bot] avatar Apr 11 '24 13:04 socket-security[bot]

The following commits were not verified: ba44a3901f2623316adc3d9fb72e8fd5b77a2afc (unsigned)

github-actions[bot] avatar Apr 25 '24 03:04 github-actions[bot]

[puLL-Merge] - brave-intl/publishers@4393

Description

This PR adds several new API endpoints and features to the Publishers app, primarily focused on enabling publishers to manage their channels and crypto addresses. The main changes include:

  • New /api/nextv1/channels endpoint for destroying channels
  • New /api/nextv1/connection endpoints for managing Bitflyer, Gemini, and Uphold connections
  • New /api/nextv1/crypto_address_for_channels endpoints for managing crypto addresses associated with channels
  • New /api/nextv1/crypto_addresses endpoint for managing a publisher's crypto addresses
  • New /api/nextv1/home endpoints for fetching publisher dashboard data
  • Addition of failed verification details and call-to-action on the Channel model
  • Updates to publishers_helper and site_banners.yml fixture
Changes

Changes

app/controllers/api/nextv1/channels_controller.rb

  • Adds endpoint to destroy a channel belonging to the current publisher

app/controllers/api/nextv1/connection/*_connections_controller.rb

  • Adds endpoints to manage Bitflyer, Gemini and Uphold connections for the current publisher

app/controllers/api/nextv1/crypto_address_for_channels_controller.rb

  • Adds endpoints to manage crypto addresses associated with a specific channel
  • Includes methods to verify Solana and Ethereum addresses

app/controllers/api/nextv1/crypto_addresses_controller.rb

  • Adds endpoints to fetch and destroy crypto addresses belonging to the current publisher

app/controllers/api/nextv1/home_controller.rb

  • Adds endpoints to fetch publisher dashboard data including channels, wallet info, and deposit dates

app/models/channel.rb

  • Adds failed_verification_details and failed_verification_call_to_action methods to return user-friendly messages about why a channel failed verification

app/helpers/publishers_helper.rb

  • Updates next_deposit_date to return date in "Month DD, YYYY" format

test/fixtures/site_banners.yml

  • Adds fixture data for new default verified channel

Security Hotspots

None identified. The added API endpoints properly authenticate the current publisher and check ownership of resources before allowing create/update/delete operations.

github-actions[bot] avatar May 29 '24 19:05 github-actions[bot]

The github comment above is correct that these are new files, but none of these are truly 'new' code. Everything referenced above is cut/pasted from an old controller almost verbatim, except for returning JSON instead of HTML.

The main exception is the dashboard endpoint in the home controller. It combines code from the home endpoint of publishers/app/controllers/publishers_controller.rb and the show code from publishers/app/controllers/publishers/wallets_controller.rb. The wallets information from 'show' is left mostly untouched, and the publisher and channels information from 'home' have been edited to send only necessary information to the front end, rather than the whole of the publishers and channels objects.

jlbyrne avatar May 29 '24 21:05 jlbyrne