Skip to content

Commit

Permalink
not sure
Browse files Browse the repository at this point in the history
  • Loading branch information
loftwah committed Sep 17, 2024
1 parent 6086384 commit 8487b2c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
11 changes: 10 additions & 1 deletion lib/tasks/populate_image_local_paths.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ namespace :users do
desc "Populate avatar and banner local paths for existing users"
task populate_image_local_paths: :environment do
User.find_each do |user|
Rails.logger.info "Processing user: #{user.username}"

avatar_valid = user.valid_url?(user.avatar)
banner_valid = user.valid_url?(user.banner)

Rails.logger.info "User: #{user.username}, Avatar URL: #{user.avatar}, Valid: #{avatar_valid}"
Rails.logger.info "User: #{user.username}, Banner URL: #{user.banner}, Valid: #{banner_valid}"

user.send(:download_and_store_image, :avatar, User::FALLBACK_AVATAR_URL)
user.send(:download_and_store_image, :banner, User::FALLBACK_BANNER_URL)

print "."
end
puts "\nDone!"
end
end
end
9 changes: 7 additions & 2 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ export default defineConfig({
}
}
},
assetsInclude: ['**/*.png', '**/*.jpg', '**/*.jpeg', '**/*.svg']
});
assetsInclude: ['app/javascript/**/*.{png,jpg,jpeg,svg}'], // Only process assets in JS folder
server: {
watch: {
ignored: ['public/avatars/**/*', 'public/banners/**/*'] // Ignore dynamic avatar and banner folders
}
}
});

0 comments on commit 8487b2c

Please sign in to comment.