Skip to content

Commit

Permalink
make updates to ease testing on staging
Browse files Browse the repository at this point in the history
  • Loading branch information
jlbyrne committed Oct 20, 2023
1 parent 3ad2ca3 commit 7f45606
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/public_channel_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def show
}

# Handle the case when the resource is not found
if channel.nil? || @crypto_addresses.empty? || current_publisher != channel.publisher || !current_publisher.feature_flags["p2p_enabled"]
if channel.nil? || @crypto_addresses.empty? || !current_publisher.feature_flags["p2p_enabled"]
redirect_to root_path, alert: "Channel not found"
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ def has_valid_uphold_connection?
end

def set_public_identifier
return if public_identifier.present?
# return if public_identifier.present?
identifier = loop do
id = SecureRandom.hex(10)
id = SecureRandom.alphanumeric(10)
break id unless Channel.where(public_identifier: id).exists?
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace :database_updates do
desc "Backfill Channel public_identifiers"
task backfill_channel_public_identifiers: :environment do
puts "Attempting to update #{Channel.where(public_identifier: nil).count} channels"
Channel.where(public_identifier: nil).pluck(:id).each_slice(1000) do |channel_chunk|
puts "Attempting to update #{Channel.all.count} channels"
Channel.all.pluck(:id).each_slice(1000) do |channel_chunk|
CreatePublicIdentifiersJob.perform_later(channel_chunk)
end
puts "Done!"
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/channels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ alice_default_twitter:
publisher: default
details: uphold_connected_twitter_default (TwitterChannelDetails)
verified: true
public_identifier: 'c6587d7de522444595e2'
public_identifier: 'S8baxMJnPl'

alice_default_twitter_ii:
publisher: default
details: uphold_connected_twitter_default_ii (TwitterChannelDetails)
verified: true
public_identifier: 'fd04faddd96bdd3b9840'
public_identifier: 'aOxAg8BAJe'

youtube_initial:
publisher: youtube_initial
Expand Down

0 comments on commit 7f45606

Please sign in to comment.