diff --git a/.tool-versions b/.tool-versions index 71a24443..8393d8db 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -ruby 3.0.2 +ruby 3.1.6 nodejs 18.15.0 diff --git a/Dockerfile b/Dockerfile index 17a77e3d..60c13fb3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.0.2-alpine3.13 +FROM ruby:3.1.6-alpine ENV LANG C.UTF-8 ARG BUNDLE_GITHUB__COM diff --git a/Gemfile b/Gemfile index b1746ae9..a8b19ada 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -ruby "3.0.2" +ruby "3.1.6" gem "rails", "6.1.7.7" diff --git a/Gemfile.lock b/Gemfile.lock index 55e8d28e..09784eed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -135,7 +135,8 @@ GEM concurrent-ruby (1.2.3) connection_pool (2.4.1) console_color (0.0.6) - crack (0.4.5) + crack (1.0.0) + bigdecimal rexml crass (1.0.6) css_parser (1.9.0) @@ -231,7 +232,7 @@ GEM haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) railties (>= 5.1) - hashdiff (1.0.1) + hashdiff (1.1.2) hashie (4.1.0) html2haml (2.2.0) erubis (~> 2.7.0) @@ -253,6 +254,7 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) + json (2.9.0) jwt (2.2.3) kaminari (1.2.1) activesupport (>= 4.1.0) @@ -270,6 +272,8 @@ GEM rexml (>= 3.3.9) kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) + language_server-protocol (3.17.0.3) + lint_roller (1.1.0) listen (3.4.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -443,20 +447,21 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.10.2) - rubocop (1.14.0) + rubocop (1.68.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.5.0, < 2.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) + unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.36.2) parser (>= 3.3.1.0) - rubocop-performance (1.11.2) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) + rubocop-performance (1.22.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) ruby_parser (3.15.1) @@ -529,9 +534,18 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - standard (1.1.1) - rubocop (= 1.14.0) - rubocop-performance (= 1.11.2) + standard (1.42.1) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.68.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.5) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.5.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.22.0) temple (0.8.2) thor (1.3.2) tilt (2.4.0) @@ -546,8 +560,8 @@ GEM uniform_notifier (1.16.0) unleash (4.0.0) murmurhash3 (~> 0.1.6) - webmock (3.12.2) - addressable (>= 2.3.6) + webmock (3.24.0) + addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) websocket (1.2.11) @@ -625,7 +639,7 @@ DEPENDENCIES yarjuf RUBY VERSION - ruby 3.0.2p107 + ruby 3.1.6p260 BUNDLED WITH 2.2.26 diff --git a/app/graphql/resolvers/concerns/resolvers/submissionable.rb b/app/graphql/resolvers/concerns/resolvers/submissionable.rb index ad14a341..f2a551f6 100644 --- a/app/graphql/resolvers/concerns/resolvers/submissionable.rb +++ b/app/graphql/resolvers/concerns/resolvers/submissionable.rb @@ -37,7 +37,7 @@ def external_submission_id end def compute_error - return IdsNotPassed unless ids_passed? + IdsNotPassed unless ids_passed? end def ids_passed? diff --git a/app/graphql/resolvers/offer_resolver.rb b/app/graphql/resolvers/offer_resolver.rb index 201fd6a4..23b59394 100644 --- a/app/graphql/resolvers/offer_resolver.rb +++ b/app/graphql/resolvers/offer_resolver.rb @@ -24,7 +24,7 @@ def run private def compute_error - return BadArgumentError unless admin? || partner? || user? + BadArgumentError unless admin? || partner? || user? end def validate_user(offer) diff --git a/app/helpers/submissions_helper.rb b/app/helpers/submissions_helper.rb index 807f4ffc..17088e2e 100644 --- a/app/helpers/submissions_helper.rb +++ b/app/helpers/submissions_helper.rb @@ -129,7 +129,7 @@ def formatted_minimum_price_for_email(submission) def artist_supply_priority(is_p1: false, target_supply: false, **) return "P1" if is_p1 - return "P2" if target_supply + "P2" if target_supply end def assignable_admin?(user) diff --git a/app/helpers/utm_params_helper.rb b/app/helpers/utm_params_helper.rb index 03ce9c88..0ad2b265 100644 --- a/app/helpers/utm_params_helper.rb +++ b/app/helpers/utm_params_helper.rb @@ -1,7 +1,7 @@ module UtmParamsHelper def utm_params(source:, campaign:, **args) initial = {utm_campaign: campaign, utm_medium: "email", utm_source: source} - transformed_args = args.each_with_object({}) { |(key, value), obj| obj["utm_#{key}".to_sym] = value } + transformed_args = args.each_with_object({}) { |(key, value), obj| obj[:"utm_#{key}"] = value } initial.merge(transformed_args) end diff --git a/app/mailers/admin_mailer.rb b/app/mailers/admin_mailer.rb index 941ed44f..d7c53844 100644 --- a/app/mailers/admin_mailer.rb +++ b/app/mailers/admin_mailer.rb @@ -16,9 +16,9 @@ def submission(submission:, user:, artist:) ) smtpapi category: %w[submission], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail( to: Convection.config.admin_email_address, subject: "Submission ##{@submission.id}" @@ -33,9 +33,9 @@ def submission_approved(submission:, artist:) assigned_admin = AdminUser.find_by(gravity_user_id: submission.assigned_to) smtpapi category: %w[submission], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail( to: assigned_admin.email, @@ -51,9 +51,9 @@ def submission_resubmitted(submission:, artist:) assigned_admin = AdminUser.find_by(gravity_user_id: submission.assigned_to) smtpapi category: %w[submission], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail( to: assigned_admin.email, @@ -72,9 +72,9 @@ def artwork_updated(submission:, artwork_data:, changes: nil, image_added: nil) @image_added = image_added smtpapi category: %w[submission], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail( to: assigned_admin.email, diff --git a/app/mailers/partner_mailer.rb b/app/mailers/partner_mailer.rb index e95f4a98..cb5d6325 100644 --- a/app/mailers/partner_mailer.rb +++ b/app/mailers/partner_mailer.rb @@ -21,9 +21,9 @@ def submission_digest( content: "sub-digest-auction" ) smtpapi category: %w[submission_digest], - unique_args: { - partner_name: partner_name - } + unique_args: { + partner_name: partner_name + } current_date = Time.now.utc.strftime("%B %-d") mail( diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index a7b28c49..ce8dae35 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -16,9 +16,9 @@ def submission_receipt(submission:, artist:) ) smtpapi category: %w[submission_receipt], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail( to: submission.email, subject: "Thank you for submitting your artwork to Artsy", @@ -35,9 +35,9 @@ def first_upload_reminder(submission:) ) smtpapi category: %w[first_upload_reminder], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail to: submission.email, subject: "You're Almost Done" end @@ -50,11 +50,11 @@ def second_upload_reminder(submission:) ) smtpapi category: %w[second_upload_reminder], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail to: submission.email, - subject: "Artsy Consignments - complete your submission" + subject: "Artsy Consignments - complete your submission" end def submission_approved(submission:, artist:) @@ -69,9 +69,9 @@ def submission_approved(submission:, artist:) ) smtpapi category: %w[submission_approved], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail( to: submission.email, subject: "Artsy Approved Submission | Next Steps" @@ -90,9 +90,9 @@ def artist_submission_rejected(submission:, artist:) ) smtpapi category: %w[artist_submission_rejected], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail(to: submission.email, subject: "An update about your submission") end @@ -108,9 +108,9 @@ def fake_submission_rejected(submission:, artist:) ) smtpapi category: %w[fake_submission_rejected], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail(to: submission.email, subject: "Artsy Submission") end @@ -128,9 +128,9 @@ def nsv_bsv_submission_rejected(submission:, artist:, logged_in:) ) smtpapi category: %w[nsv_bsv_submission_rejected], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } title = submission.title || "Unknown" artist_name = artist&.name subject = "Update on \"#{title}\" #{artist_name ? "by #{artist_name}" : ""}" @@ -150,9 +150,9 @@ def non_target_supply_artist_rejected(submission:, artist:) ) smtpapi category: %w[non_target_supply_artist_rejected], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail(to: submission.email, subject: "An update about your submission") end @@ -168,9 +168,9 @@ def other_submission_rejected(submission:, artist:) ) smtpapi category: %w[other_submission_rejected], - unique_args: { - submission_id: submission.id - } + unique_args: { + submission_id: submission.id + } mail(to: submission.email, subject: "An update about your submission") end diff --git a/app/models/concerns/percentize.rb b/app/models/concerns/percentize.rb index 6ad8e8f4..6ea9e373 100644 --- a/app/models/concerns/percentize.rb +++ b/app/models/concerns/percentize.rb @@ -9,15 +9,15 @@ module Percentize class_methods do def percentize(*method_names) method_names.each do |method_name| - attribute "#{method_name}_whole".to_sym + attribute :"#{method_name}_whole" - define_method "#{method_name}_whole" do + define_method :"#{method_name}_whole" do return if self[method_name].blank? (self[method_name] * 100).round(2) end - define_method "#{method_name}_whole=" do |percent_whole| + define_method :"#{method_name}_whole=" do |percent_whole| if percent_whole.blank? self[method_name] = nil else diff --git a/app/models/offer.rb b/app/models/offer.rb index 9ed8f4a8..29217e66 100644 --- a/app/models/offer.rb +++ b/app/models/offer.rb @@ -82,7 +82,7 @@ def set_state # defines methods sent?, accepted?, etc. for each possible offer state STATES.each do |method| - define_method "#{method}?".to_sym do + define_method :"#{method}?" do state == method end end diff --git a/app/models/submission.rb b/app/models/submission.rb index c58d3783..582ce030 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -117,7 +117,7 @@ def sale_state end def sorted_images - images.sort_by.with_index { |a, i| a == primary_image ? -1 : i } + images.sort_by.with_index { |a, i| (a == primary_image) ? -1 : i } end def as_json(options = {}) @@ -170,7 +170,7 @@ def thumbnail # defines methods submitted?, approved?, etc. for each possible submission state STATES.each do |method| - define_method "#{method}?".to_sym do + define_method :"#{method}?" do state == method end end diff --git a/config/application.rb b/config/application.rb index 1b0973f2..155d4d1f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,6 +4,7 @@ require "rails/all" require_relative "../lib/jwt_middleware" +require "ostruct" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb index f4556db3..6d56e439 100644 --- a/config/initializers/application_controller_renderer.rb +++ b/config/initializers/application_controller_renderer.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index d0f0d3b5..4b63f289 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 98230c98..87fd451f 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Define an application-wide content security policy diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index aa7435fb..dc847422 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 6e1d16f0..be6fedc5 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 50bcf4ea..810aadeb 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Define an application-wide HTTP permissions policy. For further # information see https://developers.google.com/web/updates/2018/06/feature-policy # diff --git a/spec/requests/api/graphql/mutations/add_user_to_submission_spec.rb b/spec/requests/api/graphql/mutations/add_user_to_submission_spec.rb index 4c886961..ab09ebda 100644 --- a/spec/requests/api/graphql/mutations/add_user_to_submission_spec.rb +++ b/spec/requests/api/graphql/mutations/add_user_to_submission_spec.rb @@ -22,7 +22,7 @@ mutation = <<-GRAPHQL mutation { - addUserToSubmission(input: { id: \"#{submission.uuid}\" }) { + addUserToSubmission(input: { id: "#{submission.uuid}" }) { clientMutationId consignmentSubmission { externalId @@ -46,7 +46,7 @@ mutation = <<-GRAPHQL mutation { - addUserToSubmission(input: { id: \"#{submission.uuid}\" }) { + addUserToSubmission(input: { id: "#{submission.uuid}" }) { clientMutationId consignmentSubmission { externalId @@ -68,7 +68,7 @@ mutation = <<-GRAPHQL mutation { - addUserToSubmission(input: { id: \"#{submission.uuid}\" }) { + addUserToSubmission(input: { id: "#{submission.uuid}" }) { clientMutationId consignmentSubmission { externalId @@ -94,7 +94,7 @@ mutation = <<-GRAPHQL mutation { - addUserToSubmission(input: { id: \"#{submission.uuid}\" }) { + addUserToSubmission(input: { id: "#{submission.uuid}" }) { clientMutationId consignmentSubmission { externalId @@ -120,7 +120,7 @@ mutation = <<-GRAPHQL mutation { - addUserToSubmission(input: { id: \"#{submission.id}\" }) { + addUserToSubmission(input: { id: "#{submission.id}" }) { clientMutationId consignmentSubmission { externalId