Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 'Improve ActiveStorage asset linking performance' to v0.28 #13228

Commits on Jul 29, 2024

  1. Improve ActiveStorage asset linking performance

    * Improve ActiveStorage asset linking performance
    
    Use direct links to the assets living at storage services in order
    to push most of the application load to the storage service
    instead of the website itself.
    
    * Fix issues serving image variants directly through the storage service
    
    The image variants need to be processed through the local
    representation URLs when they are served the first time because
    this is when these assets are processed for the first time.
    
    These changes detect if the variant needs processing and serves
    it through the local representation URL before the image has been
    processed. If the image is already processed it is served directly
    through the storage service itself.
    
    * Fix and extend the storage asset router specs
    
    - Fix the storage asset specs to match the current implementation
    - Add more tests to test the router under different configurations
      and options
    - Add an RSpec support utility to define the storage host when the
      storage URLs are tested outside of a request context
    
    * Fix typo
    
    * Define the current host for the assets for all specs
    
    In order to avoid adding the asset support hooks to too many
    specs.
    
    * Fix spelling issues
    
    * Improve the storage router logic for local disk storage
    
    - Add more logic for the disk service to determine the
      availability of the current host before generating the URL
    - Define the current host based on the record if the record has
      details about its organization, only if the current host hasn't
      been set already
    
    * Add the ActiveStorage::SetCurrent concern to devise controllers
    
    * Fix specs broken due to the changes in the asset URL generation
    
    As the URLs are now changed every time they are generated, this
    caused some specs to fail that assumed the URL of the asset is
    matches always the format in which it was first generated.
    
    The asset URL includes the expiry information and the expiry
    information is different every time the URL is requested.
    
    * Fix spelling in variable name
    
    * Different strategy to escape the string included in the regexp
    
    * Fix id documents verification flaky spec
    
    * Fix further specs expecting blob URLs
    
    As the URLs can be different every time they are requested, use
    different strategy for testing.
    
    * Use different matching strategy for questionnaire file answers
    
    In order to fix the CodeQL violations.
    
    * Fix flaky specs for inviting process users
    
    * Fix assembly serializer spec for checking the file URLs
    
    * Consider that the asset can be  in the generators spec
    
    * Fix participatory process group type spec for checking the file URLs
    
    * Test the participatory process presenter without setting the current host
    
    * Ensure that  also exists at the storage service
    
    In case the variant is already created at the database but not
    yet uploaded to the storage service, it might not be available
    yet.
    
    * Method naming and add documentation to the new method
    
    - Use the same conventions for the method name as Ruby and Rails
    - Add method documentation
    
    * Add a note about checking that the variant exists at the storage
    
    * Add a spec for unexisting and processed variant with record
    
    Test the situation when ActiveStorage reports the asset to be
    processed but it does not exist at the storage service as this
    caused some of the system specs to fail before.
    
    * Use the  matcher instead of
    
    * Improve the regexp matching in the asset router
    
    * Fix passing incompatible URL options to
    
    * Simplify logic
    
    The options do not need to be merged twice.
    
    * Apply suggestions from code review
    
    Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
    
    * Fix unescaped dots in the spec regexps
    
    * Fix unescaped host name dots in the spec regexps
    
    * Fix rubocop violation
    
    * Fix error when trying to display image with empty source
    
    The  helper requires the image source to be present.
    Otherwise an error will be thrown.
    
    * Use  instead of escaping dots only
    
    * Fix endless loop in the
    
    * Fix ActiveStorage deprecation warnings
    
    * Fix translated organization name
    
    Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
    
    * Ensure DiskService availability with current host requirement
    
    Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
    
    * Remove reference to participatory process banner image
    
    * Fix broken tests
    
    * Fix more specs
    
    ---------
    
    Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
    2 people authored and andreslucena committed Jul 29, 2024
    Configuration menu
    Copy the full SHA
    56609c4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    54a4b63 View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2024

  1. Fix bad merge

    andreslucena committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    c06d33b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1242b79 View commit details
    Browse the repository at this point in the history
  3. Fix specs and bad merges

    andreslucena committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    f452855 View commit details
    Browse the repository at this point in the history