From 7414d85bd7d35fe004a301d88d7dfb20d651e207 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 00:53:19 +0000 Subject: [PATCH 01/27] Bump capybara from 3.39.2 to 3.40.0 (#2163) --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 94fc0aebe..7d0b95c66 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -88,7 +88,7 @@ GEM minitest (>= 5.1) mutex_m tzinfo (~> 2.0) - addressable (2.8.5) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) apimatic_core (0.3.4) apimatic_core_interfaces (~> 0.2.0) @@ -138,11 +138,11 @@ GEM msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) - capybara (3.39.2) + capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) @@ -372,7 +372,7 @@ GEM redcarpet (3.6.0) redis-client (0.19.1) connection_pool - regexp_parser (2.8.3) + regexp_parser (2.9.0) reline (0.4.2) io-console (~> 0.5) rexml (3.2.6) From 481f6b278a4b152a1fccf112abf2344e99ad48eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 00:02:20 +0000 Subject: [PATCH 02/27] Bump bootsnap from 1.17.1 to 1.18.1 (#2165) --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 83f484dc7..2100e43d4 100644 --- a/Gemfile +++ b/Gemfile @@ -87,7 +87,7 @@ gem "tzinfo-data", "~> 1.2021", platforms: %i[mingw mswin x64_mingw jruby] # Performance Optimization # # Reduces boot times through caching; required in config/boot.rb -gem "bootsnap", "~> 1.17", require: false +gem "bootsnap", "~> 1.18", require: false # Permissions and policies gem "pundit", "~> 2.3" diff --git a/Gemfile.lock b/Gemfile.lock index 7d0b95c66..3e17450ea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -134,7 +134,7 @@ GEM bindex (0.8.1) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) - bootsnap (1.17.1) + bootsnap (1.18.1) msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) @@ -545,7 +545,7 @@ DEPENDENCIES bcrypt (~> 3.1.20) better_errors binding_of_caller - bootsnap (~> 1.17) + bootsnap (~> 1.18) capybara cssbundling-rails decent_exposure (~> 3.0) From ad4c1dcdf993026a42e8ab55c5c376caa7eed5a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 00:02:30 +0000 Subject: [PATCH 03/27] Bump @sentry/browser from 7.98.0 to 7.99.0 (#2166) --- package.json | 2 +- yarn.lock | 140 +++++++++++++++++++++++++-------------------------- 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/package.json b/package.json index 88bd3a4dd..782b229f8 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@hotwired/turbo-rails": "^7.3.0", "@rails/actioncable": "^7.1.3", "@rails/activestorage": "^7.1.3", - "@sentry/browser": "^7.98.0", + "@sentry/browser": "^7.99.0", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.10", "@webpack-cli/serve": "^2.0.5", diff --git a/yarn.lock b/yarn.lock index d6c8333d2..a6eb1b90b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -380,76 +380,76 @@ dependencies: spark-md5 "^3.0.1" -"@sentry-internal/feedback@7.98.0": - version "7.98.0" - resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-7.98.0.tgz#2dabbdc060dca49e79536ae99a9bd55f9c6f806f" - integrity sha512-t/mATvwkLcQLKRlx8SO5vlUjaadF6sT3lfR0PdWYyBy8qglbMTHDW4KP6JKh1gdzTVQGnwMByy+/4h9gy4AVzw== - dependencies: - "@sentry/core" "7.98.0" - "@sentry/types" "7.98.0" - "@sentry/utils" "7.98.0" - -"@sentry-internal/replay-canvas@7.98.0": - version "7.98.0" - resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-7.98.0.tgz#108160c49f714a6021368fd60e08b7291fe44450" - integrity sha512-vAR6KIycyazaY9HwxG5UONrPTe8jeKtZr6k04svPC8OvcoI0xF+l1jMEYcarffuzKpZlPfssYb5ChHtKuXCB+Q== - dependencies: - "@sentry/core" "7.98.0" - "@sentry/replay" "7.98.0" - "@sentry/types" "7.98.0" - "@sentry/utils" "7.98.0" - -"@sentry-internal/tracing@7.98.0": - version "7.98.0" - resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.98.0.tgz#812ef7fce6b64794784f3279c66bc6b5cfd29d7f" - integrity sha512-FnhD2uMLIAJvv4XsYPv3qsTTtxrImyLxiZacudJyaWFhxoeVQ8bKKbWJ/Ar68FAwqTtjXMeY5evnEBbRMcQlaA== - dependencies: - "@sentry/core" "7.98.0" - "@sentry/types" "7.98.0" - "@sentry/utils" "7.98.0" - -"@sentry/browser@^7.98.0": - version "7.98.0" - resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.98.0.tgz#f249e6e38351de4cea1142f498e1169006e5dd76" - integrity sha512-/MzTS31N2iM6Qwyh4PSpHihgmkVD5xdfE5qi1mTlwQZz5Yz8t7MdMriX8bEDPlLB8sNxl7+D6/+KUJO8akX0nQ== - dependencies: - "@sentry-internal/feedback" "7.98.0" - "@sentry-internal/replay-canvas" "7.98.0" - "@sentry-internal/tracing" "7.98.0" - "@sentry/core" "7.98.0" - "@sentry/replay" "7.98.0" - "@sentry/types" "7.98.0" - "@sentry/utils" "7.98.0" - -"@sentry/core@7.98.0": - version "7.98.0" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.98.0.tgz#e4f5353bc3986e510b8dd2507355787440d6e25d" - integrity sha512-baRUcpCNGyk7cApQHMfqEZJkXdvAKK+z/dVWiMqWc5T5uhzMnPE8/gjP1JZsMtJSQ8g5nHimBdI5TwOyZtxPaA== - dependencies: - "@sentry/types" "7.98.0" - "@sentry/utils" "7.98.0" - -"@sentry/replay@7.98.0": - version "7.98.0" - resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.98.0.tgz#21ba96d501260c1a33bc1af445f5cfbe02d0ba30" - integrity sha512-CQabv/3KnpMkpc2TzIquPu5krpjeMRAaDIO0OpTj5SQeH2RqSq3fVWNZkHa8tLsADxcfLFINxqOg2jd1NxvwxA== - dependencies: - "@sentry-internal/tracing" "7.98.0" - "@sentry/core" "7.98.0" - "@sentry/types" "7.98.0" - "@sentry/utils" "7.98.0" - -"@sentry/types@7.98.0": - version "7.98.0" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.98.0.tgz#6a88bf60679aea88ac6cba4d1517958726c2bafb" - integrity sha512-pc034ziM0VTETue4bfBcBqTWGy4w0okidtoZJjGVrYAfE95ObZnUGVj/XYIQ3FeCYWIa7NFN2MvdsCS0buwivQ== - -"@sentry/utils@7.98.0": - version "7.98.0" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.98.0.tgz#54355a197f7f71a6d17354a3d043022df402b502" - integrity sha512-0/LY+kpHxItVRY0xPDXPXVsKRb95cXsGSQf8sVMtfSjz++0bLL1U4k7PFz1c5s2/Vk0B8hS6duRrgMv6dMIZDw== - dependencies: - "@sentry/types" "7.98.0" +"@sentry-internal/feedback@7.99.0": + version "7.99.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-7.99.0.tgz#c3fec1500cb24c9a5e09479d478fddca909477da" + integrity sha512-exIO1o+bE0MW4z30FxC0cYzJ4ZHSMlDPMHCBDPzU+MWGQc/fb8s58QUrx5Dnm6HTh9G3H+YlroCxIo9u0GSwGQ== + dependencies: + "@sentry/core" "7.99.0" + "@sentry/types" "7.99.0" + "@sentry/utils" "7.99.0" + +"@sentry-internal/replay-canvas@7.99.0": + version "7.99.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-7.99.0.tgz#d6ba7eec7ab2f7210a7deb6daa4dd82f7b1e9e29" + integrity sha512-PoIkfusToDq0snfl2M6HJx/1KJYtXxYhQplrn11kYadO04SdG0XGXf4h7wBTMEQ7LDEAtQyvsOu4nEQtTO3YjQ== + dependencies: + "@sentry/core" "7.99.0" + "@sentry/replay" "7.99.0" + "@sentry/types" "7.99.0" + "@sentry/utils" "7.99.0" + +"@sentry-internal/tracing@7.99.0": + version "7.99.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.99.0.tgz#ad13f8343444ecf7323a4220d4e57a55166565d7" + integrity sha512-z3JQhHjoM1KdM20qrHwRClKJrNLr2CcKtCluq7xevLtXHJWNAQQbafnWD+Aoj85EWXBzKt9yJMv2ltcXJ+at+w== + dependencies: + "@sentry/core" "7.99.0" + "@sentry/types" "7.99.0" + "@sentry/utils" "7.99.0" + +"@sentry/browser@^7.99.0": + version "7.99.0" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.99.0.tgz#3e78beb490d141c988038ea902689a1e9171c6cf" + integrity sha512-bgfoUv3wkwwLgN5YUOe0ibB3y268ZCnamZh6nLFqnY/UBKC1+FXWFdvzVON/XKUm62LF8wlpCybOf08ebNj2yg== + dependencies: + "@sentry-internal/feedback" "7.99.0" + "@sentry-internal/replay-canvas" "7.99.0" + "@sentry-internal/tracing" "7.99.0" + "@sentry/core" "7.99.0" + "@sentry/replay" "7.99.0" + "@sentry/types" "7.99.0" + "@sentry/utils" "7.99.0" + +"@sentry/core@7.99.0": + version "7.99.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.99.0.tgz#6881aae5ac1436637b3d88e0b12df4ab56016c5f" + integrity sha512-vOAtzcAXEUtS/oW7wi3wMkZ3hsb5Ch96gKyrrj/mXdOp2zrcwdNV6N9/pawq2E9P/7Pw8AXw4CeDZztZrjQLuA== + dependencies: + "@sentry/types" "7.99.0" + "@sentry/utils" "7.99.0" + +"@sentry/replay@7.99.0": + version "7.99.0" + resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.99.0.tgz#c63f2bd79a791538ba54bcd91f02379dc4d5c1cc" + integrity sha512-gyN/I2WpQrLAZDT+rScB/0jnFL2knEVBo8U8/OVt8gNP20Pq8T/rDZKO/TG0cBfvULDUbJj2P4CJryn2p/O2rA== + dependencies: + "@sentry-internal/tracing" "7.99.0" + "@sentry/core" "7.99.0" + "@sentry/types" "7.99.0" + "@sentry/utils" "7.99.0" + +"@sentry/types@7.99.0": + version "7.99.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.99.0.tgz#bba7a514abab445026ee42f40f92f81275a6deba" + integrity sha512-94qwOw4w40sAs5mCmzcGyj8ZUu/KhnWnuMZARRq96k+SjRW/tHFAOlIdnFSrt3BLPvSOK7R3bVAskZQ0N4FTmA== + +"@sentry/utils@7.99.0": + version "7.99.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.99.0.tgz#ef96c3b59e23c79f3ef500db508234a48fa1cfbe" + integrity sha512-cYZy5WNTkWs5GgggGnjfGqC44CWir0pAv4GVVSx0fsup4D4pMKBJPrtub15f9uC+QkUf3vVkqwpBqeFxtmJQTQ== + dependencies: + "@sentry/types" "7.99.0" "@sindresorhus/merge-streams@^1.0.0": version "1.0.0" From b4cb3f163b4d13d8f4ee9b973ab812eb4dcf727a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 01:11:51 +0000 Subject: [PATCH 04/27] Bump bootsnap from 1.18.1 to 1.18.3 (#2167) --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3e17450ea..a64c2e36e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -134,7 +134,7 @@ GEM bindex (0.8.1) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) - bootsnap (1.18.1) + bootsnap (1.18.3) msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) From 3dd918e58cf0fe16e66d22e093c383b805b788ac Mon Sep 17 00:00:00 2001 From: Zee <50284+zspencer@users.noreply.github.com> Date: Sat, 3 Feb 2024 11:32:19 -0800 Subject: [PATCH 05/27] =?UTF-8?q?=E2=9C=A8=F0=9F=A5=A1=20`Marketplace`:=20?= =?UTF-8?q?Add=20`Product#servings`=20(#2171)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ๐Ÿฅ— `Marketplace`: Test Listing `Products` - https://github.com/zinc-collective/convene/issues/2168 It may be nice to get rid of the `Rspec/ExampleLength` cop, because omg it doesn't make sense to apply it in the case of system specs. But I also don't know enough about how to do that effortlessly, and I am too lazy to put in the effort right now. Also apparently we may be able to get rid of the `chomp`! Apparently ```rb <<~THING.gsub("\n", " ") Should wind up as having no line breaks THING ``` Also, it would be nice if `within(created_product)` did the same thing as `within("##{dom_id(created_product)}")` since that looks horrifying. Maybe `visit(object)` could do something similar with polymorphic path? Co-Authored-By: Tim Taylor * ๐Ÿงน We don't need that `chomp`! Co-authored-by: toolbear@users.noreply.github.com * ๐Ÿฅ—โœจ `Marketplace`: Add `Product#servings` - https://github.com/zinc-collective/convene/issues/2170 We can get the Products serving size and show them to the user * ๐Ÿงน `Marketplace`: Extract `Product::TitleComponent` I don't know how useful this is, but I did notice that we were doing the same thing 4 times and wanted to put it in a place of it's own. --------- Co-authored-by: Tim Taylor --- .../menu/product_component.html.erb | 16 ++++++---- .../product/title_component.html.erb | 2 ++ .../marketplace/product/title_component.rb | 10 ++++++ .../marketplace/product_component.html.erb | 12 ++++--- app/furniture/marketplace/product_policy.rb | 2 +- .../marketplace/products/_form.html.erb | 2 ++ ...07_marketplace_add_servings_to_products.rb | 5 +++ db/schema.rb | 3 +- .../selling_products_system_spec.rb | 32 +++++++++++++++++++ 9 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 app/furniture/marketplace/product/title_component.html.erb create mode 100644 app/furniture/marketplace/product/title_component.rb create mode 100644 db/migrate/20240201014607_marketplace_add_servings_to_products.rb diff --git a/app/furniture/marketplace/menu/product_component.html.erb b/app/furniture/marketplace/menu/product_component.html.erb index 73f2793b1..d9f610162 100644 --- a/app/furniture/marketplace/menu/product_component.html.erb +++ b/app/furniture/marketplace/menu/product_component.html.erb @@ -1,16 +1,20 @@ <%= render CardComponent.new(dom_id: dom_id(product)) do |card| %> - <%- card.with_header(variant: :no_padding) do %> - <% if product.photo.present? %> + + <% if product.photo.present? %> + <%- card.with_header(variant: :no_padding) do %>
<%= image_tag hero_image, class: "rounded-t-lg w-full" %>
-

<%= name %>

+ <%= render Marketplace::Product::TitleComponent.new(product:) %>
- <%- else %> -

<%= name %>

+ <%- end %> + <%- else %> + <%- card.with_header do %> + <%= render Marketplace::Product::TitleComponent.new(product:) %> <% end %> - <%- end %> + <% end %> +
<%= description %> diff --git a/app/furniture/marketplace/product/title_component.html.erb b/app/furniture/marketplace/product/title_component.html.erb new file mode 100644 index 000000000..65136464f --- /dev/null +++ b/app/furniture/marketplace/product/title_component.html.erb @@ -0,0 +1,2 @@ +

<%= name %>

+

Serves <%= servings %>

diff --git a/app/furniture/marketplace/product/title_component.rb b/app/furniture/marketplace/product/title_component.rb new file mode 100644 index 000000000..7c9543645 --- /dev/null +++ b/app/furniture/marketplace/product/title_component.rb @@ -0,0 +1,10 @@ +class Marketplace + class Product::TitleComponent < Component + attr_accessor :product + delegate :servings, :name, to: :product + + def initialize(product:) + self.product = product + end + end +end diff --git a/app/furniture/marketplace/product_component.html.erb b/app/furniture/marketplace/product_component.html.erb index 08a966de5..aa3c4b5c5 100644 --- a/app/furniture/marketplace/product_component.html.erb +++ b/app/furniture/marketplace/product_component.html.erb @@ -1,18 +1,20 @@ <%= render CardComponent.new(dom_id: dom_id(product)) do |card| %> - <%- card.with_header(variant: :no_padding) do %> - <% if product.photo.present? %> + <% if product.photo.present? %> + <%- card.with_header(variant: :no_padding) do %>
<%= image_tag hero_image, class: "rounded-t-lg w-full" %>
-

<%= name %>

+ <%= render Marketplace::Product::TitleComponent.new(product:) %> <%- if product.archived? %> (archived) <%- end %>
- <%- else %> -

<%= name %>

<% end %> + <%- else %> + <%- card.with_header do %> + <%= render Marketplace::Product::TitleComponent.new(product:) %> + <%- end %> <%- end %>
diff --git a/app/furniture/marketplace/product_policy.rb b/app/furniture/marketplace/product_policy.rb index 4354d0249..908b015d3 100644 --- a/app/furniture/marketplace/product_policy.rb +++ b/app/furniture/marketplace/product_policy.rb @@ -4,7 +4,7 @@ class Marketplace class ProductPolicy < Policy alias_method :product, :object def permitted_attributes(_params = nil) - %i[name description price_cents price_currency price photo restore] + [tax_rate_ids: []] + %i[name description price_cents price_currency price photo restore servings] + [tax_rate_ids: []] end def update? diff --git a/app/furniture/marketplace/products/_form.html.erb b/app/furniture/marketplace/products/_form.html.erb index 841a659b2..3604b0fb8 100644 --- a/app/furniture/marketplace/products/_form.html.erb +++ b/app/furniture/marketplace/products/_form.html.erb @@ -2,6 +2,8 @@ <%= form_with model: product.location do |f| %> <%= render "text_field", { attribute: :name, form: f} %> <%= render "text_area", { attribute: :description, form: f} %> + <%= render "number_field", { attribute: :servings, form: f, min: 0, step: 1} %> + <%= render "money_field", { attribute: :price, form: f, min: 0, step: 0.01} %> <%= render "collection_check_boxes", { attribute: :tax_rate_ids, collection: bazaar.tax_rates, value_method: :id, text_method: :label, form: f} %> <%- if product.photo.present? %> diff --git a/db/migrate/20240201014607_marketplace_add_servings_to_products.rb b/db/migrate/20240201014607_marketplace_add_servings_to_products.rb new file mode 100644 index 000000000..f9d47945c --- /dev/null +++ b/db/migrate/20240201014607_marketplace_add_servings_to_products.rb @@ -0,0 +1,5 @@ +class MarketplaceAddServingsToProducts < ActiveRecord::Migration[7.1] + def change + add_column :marketplace_products, :servings, :integer, null: true + end +end diff --git a/db/schema.rb b/db/schema.rb index d926915c1..442d9a280 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_01_20_034325) do +ActiveRecord::Schema[7.1].define(version: 2024_02_01_014607) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -209,6 +209,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.datetime "discarded_at" + t.integer "servings" t.index ["discarded_at"], name: "index_marketplace_products_on_discarded_at" t.index ["marketplace_id"], name: "index_marketplace_products_on_marketplace_id" end diff --git a/spec/furniture/marketplace/selling_products_system_spec.rb b/spec/furniture/marketplace/selling_products_system_spec.rb index c78cc761d..f56c35ec0 100644 --- a/spec/furniture/marketplace/selling_products_system_spec.rb +++ b/spec/furniture/marketplace/selling_products_system_spec.rb @@ -12,6 +12,38 @@ sign_in(space.members.first, space) end + # @see https://github.com/zinc-collective/convene/issues/2168 + describe "Listing Products for Sale" do + it "Adds the Product to the Menu" do # rubocop:disable RSpec/ExampleLength + visit(polymorphic_path(marketplace.location(child: :products))) + click_link("Add a Product") + + fill_in("Name", with: "A Delicious Apple") + + description = <<~DESC.gsub("\n", "") + A red Apple, grown in the an Orchard + Made with a Trunk. + DESC + + fill_in("Description", with: description) + fill_in("Price", with: "10.00") + fill_in("Servings", with: 4) + + expect { click_button("Create") }.to change(marketplace.products, :count).by(1) + + created_product = marketplace.products.last + + visit(polymorphic_path(marketplace.room.location)) + + within("##{dom_id(created_product)}") do + expect(page).to have_content("A Delicious Apple") + expect(page).to have_content(description) + expect(page).to have_content("$10.00") + expect(page).to have_content("Serves 4") + end + end + end + describe "Archiving Products" do before do cart.cart_products.create(product:, quantity: 1) From 931d1cd8a252fb69e0b7ded4a71476848e2b873d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:37:15 +0000 Subject: [PATCH 06/27] Bump lookbook from 2.2.0 to 2.2.1 (#2173) --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index a64c2e36e..9a3d0d3e2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -241,7 +241,7 @@ GEM loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) - lookbook (2.2.0) + lookbook (2.2.1) activemodel css_parser htmlbeautifier (~> 1.3) From d63ae3f953663616d1c6aacc92de5d0a547ebfb3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:37:25 +0000 Subject: [PATCH 07/27] Bump stripe from 10.6.0 to 10.7.0 (#2172) --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9a3d0d3e2..0cec88ce7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -498,7 +498,7 @@ GEM stringio (3.1.0) strip_attributes (1.13.0) activemodel (>= 3.0, < 8.0) - stripe (10.6.0) + stripe (10.7.0) strong_migrations (1.7.0) activerecord (>= 5.2) thor (1.3.0) From 64cc4aae04b895556e60cff0f5740c6a10f5f6c7 Mon Sep 17 00:00:00 2001 From: Zee <50284+zspencer@users.noreply.github.com> Date: Sat, 3 Feb 2024 12:23:30 -0800 Subject: [PATCH 08/27] =?UTF-8?q?=E2=9C=A8=20`Journal`:=20`Author`=20provi?= =?UTF-8?q?des=20`Entry#summary`=20(#2161)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - When https://github.com/zinc-collective/convene-journal/issues/2, add an https://github.com/zinc-collective/convene-journal/issues/10 so we can eventually display it when https://github.com/zinc-collective/convene-journal/issues/4 * ๐Ÿงน๐Ÿฅ— `Journal`: Add `Entry#summary` field (#8) - https://github.com/zinc-collective/convene-journal/issues/10 What I'm driving towards here is similar to https://github.com/zinc-collective/convene/pull/2055, where a `Journal::Entry` has an affordance for being opinionated about how it's represented when linked to in search engines or peer-to-peer sharing; as well as short text for when there are a several on `Journal#show`. * ๐Ÿ› ๏ธ `Journal`: Test only the `Journal in CI While working on https://github.com/zinc-collective/convene-journal/pull/11, I realized I missed a piece of the refactor because I was leaning-on-ci as a way to confirm that everything was working as expected. Little did I know, CI was not working in this fork. Which makes sense, because you don't want to automatically turn on all the Workflows when you fork a project. This adds a Github Workflow for testing *just* the `Journal`, which should make detecting oopsie-daisys a bit easier for folks who are only interested in working on the Journal. * ๐Ÿฅ— `Journal`: Test adding `Entry#summary` when Writing `Entries` - https://github.com/zinc-collective/convene-journal/issues/10 - https://github.com/zinc-collective/convene-journal/issues/2 This is a quick line-of-action end-to-end test for setting an `Entry#summary`. * โœจ `Journal`: Save `Entry#summary` when Writing `Entries` - https://github.com/zinc-collective/convene-journal/issues/2 - https://github.com/zinc-collective/convene-journal/issues/10 And just like that, there's a `Summary` field on the `Journal::Entry#new` page! --- .github/workflows/test-convene-journal.yml | 154 ++++++++++++++++++ app/furniture/journal/entries/_form.html.erb | 2 + app/furniture/journal/entry.rb | 3 + app/furniture/journal/entry_policy.rb | 2 +- ...014151_journal_add_description_to_entry.rb | 5 + db/schema.rb | 1 + spec/furniture/journal/entry_spec.rb | 4 + .../journal/writing_entries_system_spec.rb | 30 ++++ 8 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-convene-journal.yml create mode 100644 db/migrate/20240129014151_journal_add_description_to_entry.rb create mode 100644 spec/furniture/journal/writing_entries_system_spec.rb diff --git a/.github/workflows/test-convene-journal.yml b/.github/workflows/test-convene-journal.yml new file mode 100644 index 000000000..385725f4c --- /dev/null +++ b/.github/workflows/test-convene-journal.yml @@ -0,0 +1,154 @@ +name: Test Journal +on: push + +env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + # Connect to locally-running Maildev for tests + SMTP_PORT: 1025 + SMTP_DOMAIN: localhost + SMTP_ENABLE_TLS: false + REDIS_HOST: redis + REDIS_PORT: 6379 + HEADLESS: true + +jobs: + setup: + name: Install and cache dependencies + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Update apt + env: + DEBIAN_FRONTEND: noninteractive + run: + sudo apt-get update -qq -o Acquire::Retries=3 + + - name: Install libvips + env: + DEBIAN_FRONTEND: noninteractive + run: + # we only need the library + sudo apt-get install --fix-missing -qq -o Acquire::Retries=3 + libvips + + - name: Setup Ruby and install gems + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Setup Node with cache + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'yarn' + + - name: Install Node dependencies + run: yarn install + + test: + name: Run Tests + runs-on: ubuntu-latest + needs: [setup] + + services: + postgres: + image: postgres:latest + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + redis: + image: redis + ports: + # Maps port 6379 on service container to the host + - 6379:6379 + # Set health checks to wait until redis has started + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Update apt + env: + DEBIAN_FRONTEND: noninteractive + run: + sudo apt-get update -qq -o Acquire::Retries=3 + + - name: Install libvips + env: + DEBIAN_FRONTEND: noninteractive + run: + # we only need the library + sudo apt-get install --fix-missing -qq -o Acquire::Retries=3 + libvips + + - name: Install Firefox + uses: browser-actions/setup-firefox@latest + + - name: Setup Ruby and install gems + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Setup Node with cache + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'yarn' + + - name: Allow Ruby process to access port 80 + run: sudo setcap 'cap_net_bind_service=+ep' `which ruby` + + - name: Setup CI database.yml + run: cp config/database.yml.github-actions config/database.yml + + - name: Setup rails + run: bin/setup-rails && bin/rails assets:precompile + + - name: Run Tests + env: + HEADLESS: true + run: bundle exec rspec spec/furniture/journal + - name: Upload RSpec Screenshots + uses: actions/upload-artifact@v2 + if: failure() + with: + name: rspec-failed-screenshot + path: tmp/capybara/*.png + + lint: + name: Run style checks + runs-on: ubuntu-latest + needs: [setup] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Ruby and install gems + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Setup Node with cache + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'yarn' + + - name: Install Node dependencies + run: yarn install + + - run: bundle exec rubocop --parallel --config .rubocop.yml + - run: yarn prettier --check "./**/*.{scss,css,js}" diff --git a/app/furniture/journal/entries/_form.html.erb b/app/furniture/journal/entries/_form.html.erb index 42186983f..8f5d33d03 100644 --- a/app/furniture/journal/entries/_form.html.erb +++ b/app/furniture/journal/entries/_form.html.erb @@ -1,5 +1,7 @@ <%= form_with model: entry.location, class: "flex flex-col grow" do |f| %> <%= render "text_field", { attribute: :headline, form: f} %> + <%= render "text_area", { attribute: :summary, form: f} %> + <%= render "text_area", { attribute: :body, form: f, field_classes: "grow", container_classes: "grow flex flex-col"} %> <%= render "datetime_field", { attribute: :published_at, form: f} %> diff --git a/app/furniture/journal/entry.rb b/app/furniture/journal/entry.rb index dd48dd6cd..e5aed1e5a 100644 --- a/app/furniture/journal/entry.rb +++ b/app/furniture/journal/entry.rb @@ -33,6 +33,9 @@ class Entry < ApplicationRecord scope :matching_keywords, ->(keywords) { where("keywords::text[] && ARRAY[?]::text[]", keywords) } + SUMMARY_MAX_LENGTH = 300 + validates :summary, length: {maximum: SUMMARY_MAX_LENGTH, allow_blank: true} + def migrate_to(journal:, keywords: []) new_body = keywords.present? ? body + "\n##{keywords.join(" #")}" : body update(journal: journal, body: new_body) diff --git a/app/furniture/journal/entry_policy.rb b/app/furniture/journal/entry_policy.rb index f54d4fb65..ebbb6bbe1 100644 --- a/app/furniture/journal/entry_policy.rb +++ b/app/furniture/journal/entry_policy.rb @@ -17,7 +17,7 @@ def update? end def permitted_attributes(_params) - %i[headline body published_at] + %i[headline summary body published_at] end class Scope < ApplicationScope diff --git a/db/migrate/20240129014151_journal_add_description_to_entry.rb b/db/migrate/20240129014151_journal_add_description_to_entry.rb new file mode 100644 index 000000000..03ef6878c --- /dev/null +++ b/db/migrate/20240129014151_journal_add_description_to_entry.rb @@ -0,0 +1,5 @@ +class JournalAddDescriptionToEntry < ActiveRecord::Migration[7.1] + def change + add_column :journal_entries, :summary, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 442d9a280..e0d2ce6e7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -116,6 +116,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "keywords", array: true + t.text "summary" t.index ["journal_id"], name: "index_journal_entries_on_journal_id" end diff --git a/spec/furniture/journal/entry_spec.rb b/spec/furniture/journal/entry_spec.rb index 8d16fff4d..840bbeb76 100644 --- a/spec/furniture/journal/entry_spec.rb +++ b/spec/furniture/journal/entry_spec.rb @@ -22,6 +22,10 @@ end end + describe "#summary" do + it { is_expected.to validate_length_of(:summary).is_at_most(300).allow_blank } + end + describe "#save" do let(:entry) { create(:journal_entry, body: "#GoodTimes") } let(:journal) { entry.journal } diff --git a/spec/furniture/journal/writing_entries_system_spec.rb b/spec/furniture/journal/writing_entries_system_spec.rb new file mode 100644 index 000000000..bd4be88d4 --- /dev/null +++ b/spec/furniture/journal/writing_entries_system_spec.rb @@ -0,0 +1,30 @@ +require "rails_helper" + +# @see https://github.com/zinc-collective/convene-journal/issues/2 +RSpec.describe "Writing Entries", type: :system do + let(:space) { create(:space, :with_entrance, :with_members) } + let(:journal) { create(:journal, room: space.entrance) } + + before do + sign_in(space.members.first, space) + end + + it "saves the headline, summary and body" do # rubocop:disable RSpec/ExampleLength + visit(polymorphic_path(journal.location(:new, child: :entry))) + + body = 1000.times.map { Faker::Books::Dune.quote }.join("\n\n") + fill_in("Headline", with: "1000 Dune Quotes") + fill_in("Body", with: body) + summary = %( + So you thought you wanted 1000 Dune Quotes? + Well, you were wrong. But here they are anyway! + ) + fill_in("Summary", with: summary) + + click_button("Create") + entry = journal.entries.last + expect(entry.headline).to eq("1000 Dune Quotes") + expect(entry.body).to eq(body) + expect(entry.summary).to eq(summary) + end +end From 982c4fe1613b5c0c10f2a707636725d017ddbee3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 00:42:21 +0000 Subject: [PATCH 09/27] Bump postcss from 8.4.33 to 8.4.34 (#2176) --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 782b229f8..8909bf68c 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@webpack-cli/serve": "^2.0.5", "autoprefixer": "^10.4.17", "event-target-shim": "^6.0.2", - "postcss": "^8.4.33", + "postcss": "^8.4.34", "postcss-cli": "^11.0.0", "postcss-flexbugs-fixes": "^5.0.2", "postcss-import": "^16.0.0", diff --git a/yarn.lock b/yarn.lock index a6eb1b90b..35787659a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1830,10 +1830,10 @@ postcss-value-parser@^4.0.0, postcss-value-parser@^4.2.0: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@^8.4.23, postcss@^8.4.33: - version "8.4.33" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.33.tgz#1378e859c9f69bf6f638b990a0212f43e2aaa742" - integrity sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg== +postcss@^8.4.23, postcss@^8.4.34: + version "8.4.34" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.34.tgz#563276e86b4ff20dfa5eed0d394d4c53853b2051" + integrity sha512-4eLTO36woPSocqZ1zIrFD2K1v6wH7pY1uBh0JIM2KKfrVtGvPFiAku6aNOP0W1Wr9qwnaCsF0Z+CrVnryB2A8Q== dependencies: nanoid "^3.3.7" picocolors "^1.0.0" From f0140fa910b4dbfffa649f5e521a08a9ae9bc5ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 01:15:37 +0000 Subject: [PATCH 10/27] Bump nokogiri from 1.16.0 to 1.16.2 (#2178) --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0cec88ce7..0e2311cd3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -291,7 +291,7 @@ GEM net-smtp (0.4.0) net-protocol nio4r (2.7.0) - nokogiri (1.16.0) + nokogiri (1.16.2) mini_portile2 (~> 2.8.2) racc (~> 1.4) pagy (6.4.3) From 3aa67b7ed71dc58a9a34aa6469fded37a4e5cac3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 01:15:49 +0000 Subject: [PATCH 11/27] Bump stripe from 10.7.0 to 10.7.1 (#2177) --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0e2311cd3..f5b90ac77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -498,7 +498,7 @@ GEM stringio (3.1.0) strip_attributes (1.13.0) activemodel (>= 3.0, < 8.0) - stripe (10.7.0) + stripe (10.7.1) strong_migrations (1.7.0) activerecord (>= 5.2) thor (1.3.0) From ed6963bef9fb2c59bb82e3fb5d33dc5df5765a3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 01:21:05 +0000 Subject: [PATCH 12/27] Bump prettier from 3.2.4 to 3.2.5 (#2175) --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8909bf68c..6aa047e32 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/zinc-collective/convene#readme", "devDependencies": { - "prettier": "^3.2.4" + "prettier": "^3.2.5" }, "dependencies": { "@hotwired/stimulus": "^3.2.2", diff --git a/yarn.lock b/yarn.lock index 35787659a..5e61e2198 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1839,10 +1839,10 @@ postcss@^8.4.23, postcss@^8.4.34: picocolors "^1.0.0" source-map-js "^1.0.2" -prettier@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.4.tgz#4723cadeac2ce7c9227de758e5ff9b14e075f283" - integrity sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ== +prettier@^3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" + integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== pretty-hrtime@^1.0.3: version "1.0.3" From ae0dbddd089735d9daf8bd411db58afec105ec42 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 00:49:53 +0000 Subject: [PATCH 13/27] Bump @sentry/browser from 7.99.0 to 7.100.0 (#2180) --- package.json | 2 +- yarn.lock | 140 +++++++++++++++++++++++++-------------------------- 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/package.json b/package.json index 6aa047e32..eb5a95933 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@hotwired/turbo-rails": "^7.3.0", "@rails/actioncable": "^7.1.3", "@rails/activestorage": "^7.1.3", - "@sentry/browser": "^7.99.0", + "@sentry/browser": "^7.100.0", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.10", "@webpack-cli/serve": "^2.0.5", diff --git a/yarn.lock b/yarn.lock index 5e61e2198..9e10a29c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -380,76 +380,76 @@ dependencies: spark-md5 "^3.0.1" -"@sentry-internal/feedback@7.99.0": - version "7.99.0" - resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-7.99.0.tgz#c3fec1500cb24c9a5e09479d478fddca909477da" - integrity sha512-exIO1o+bE0MW4z30FxC0cYzJ4ZHSMlDPMHCBDPzU+MWGQc/fb8s58QUrx5Dnm6HTh9G3H+YlroCxIo9u0GSwGQ== - dependencies: - "@sentry/core" "7.99.0" - "@sentry/types" "7.99.0" - "@sentry/utils" "7.99.0" - -"@sentry-internal/replay-canvas@7.99.0": - version "7.99.0" - resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-7.99.0.tgz#d6ba7eec7ab2f7210a7deb6daa4dd82f7b1e9e29" - integrity sha512-PoIkfusToDq0snfl2M6HJx/1KJYtXxYhQplrn11kYadO04SdG0XGXf4h7wBTMEQ7LDEAtQyvsOu4nEQtTO3YjQ== - dependencies: - "@sentry/core" "7.99.0" - "@sentry/replay" "7.99.0" - "@sentry/types" "7.99.0" - "@sentry/utils" "7.99.0" - -"@sentry-internal/tracing@7.99.0": - version "7.99.0" - resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.99.0.tgz#ad13f8343444ecf7323a4220d4e57a55166565d7" - integrity sha512-z3JQhHjoM1KdM20qrHwRClKJrNLr2CcKtCluq7xevLtXHJWNAQQbafnWD+Aoj85EWXBzKt9yJMv2ltcXJ+at+w== - dependencies: - "@sentry/core" "7.99.0" - "@sentry/types" "7.99.0" - "@sentry/utils" "7.99.0" - -"@sentry/browser@^7.99.0": - version "7.99.0" - resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.99.0.tgz#3e78beb490d141c988038ea902689a1e9171c6cf" - integrity sha512-bgfoUv3wkwwLgN5YUOe0ibB3y268ZCnamZh6nLFqnY/UBKC1+FXWFdvzVON/XKUm62LF8wlpCybOf08ebNj2yg== - dependencies: - "@sentry-internal/feedback" "7.99.0" - "@sentry-internal/replay-canvas" "7.99.0" - "@sentry-internal/tracing" "7.99.0" - "@sentry/core" "7.99.0" - "@sentry/replay" "7.99.0" - "@sentry/types" "7.99.0" - "@sentry/utils" "7.99.0" - -"@sentry/core@7.99.0": - version "7.99.0" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.99.0.tgz#6881aae5ac1436637b3d88e0b12df4ab56016c5f" - integrity sha512-vOAtzcAXEUtS/oW7wi3wMkZ3hsb5Ch96gKyrrj/mXdOp2zrcwdNV6N9/pawq2E9P/7Pw8AXw4CeDZztZrjQLuA== - dependencies: - "@sentry/types" "7.99.0" - "@sentry/utils" "7.99.0" - -"@sentry/replay@7.99.0": - version "7.99.0" - resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.99.0.tgz#c63f2bd79a791538ba54bcd91f02379dc4d5c1cc" - integrity sha512-gyN/I2WpQrLAZDT+rScB/0jnFL2knEVBo8U8/OVt8gNP20Pq8T/rDZKO/TG0cBfvULDUbJj2P4CJryn2p/O2rA== - dependencies: - "@sentry-internal/tracing" "7.99.0" - "@sentry/core" "7.99.0" - "@sentry/types" "7.99.0" - "@sentry/utils" "7.99.0" - -"@sentry/types@7.99.0": - version "7.99.0" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.99.0.tgz#bba7a514abab445026ee42f40f92f81275a6deba" - integrity sha512-94qwOw4w40sAs5mCmzcGyj8ZUu/KhnWnuMZARRq96k+SjRW/tHFAOlIdnFSrt3BLPvSOK7R3bVAskZQ0N4FTmA== - -"@sentry/utils@7.99.0": - version "7.99.0" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.99.0.tgz#ef96c3b59e23c79f3ef500db508234a48fa1cfbe" - integrity sha512-cYZy5WNTkWs5GgggGnjfGqC44CWir0pAv4GVVSx0fsup4D4pMKBJPrtub15f9uC+QkUf3vVkqwpBqeFxtmJQTQ== - dependencies: - "@sentry/types" "7.99.0" +"@sentry-internal/feedback@7.100.0": + version "7.100.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-7.100.0.tgz#38d8d4cb8ac3e6e24d91b13878bd6208a55bcab3" + integrity sha512-SMW2QhNKOuSjw8oPtvryDlJjiwrNyAKljbgtMk057os/fd8QMp38Yt1ImqLCM4B2rTQZ6REJ6hRGRTRcfqoG+w== + dependencies: + "@sentry/core" "7.100.0" + "@sentry/types" "7.100.0" + "@sentry/utils" "7.100.0" + +"@sentry-internal/replay-canvas@7.100.0": + version "7.100.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-7.100.0.tgz#b462346832631ed5a9446686419113ff331bd984" + integrity sha512-DePinj5IgNiC4RZv0yX0DLccMZebfFdKl3zHwDeLBeZqtMz9VrPzchv57IWP+5MI1+iuOn+WOg4oTNBUG6hFRw== + dependencies: + "@sentry/core" "7.100.0" + "@sentry/replay" "7.100.0" + "@sentry/types" "7.100.0" + "@sentry/utils" "7.100.0" + +"@sentry-internal/tracing@7.100.0": + version "7.100.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.100.0.tgz#01f0925a287a6e5d0becd731ab361cabbd27c007" + integrity sha512-qf4W1STXky9WOQYoPSw2AmCBDK4FzvAyq5yeD2sLU7OCUEfbRUcN0lQljUvmWRKv/jTIAyeU5icDLJPZuR50nA== + dependencies: + "@sentry/core" "7.100.0" + "@sentry/types" "7.100.0" + "@sentry/utils" "7.100.0" + +"@sentry/browser@^7.100.0": + version "7.100.0" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.100.0.tgz#adf57f660baa6190a7e1709605f73b94818ee04b" + integrity sha512-XpM0jEVe6DJWXjMSOjtJxsSNR/XnJKrlcuyoI4Re3qLG+noEF5QLc0r3VJkySXPRFnmdW05sLswQ6a/n9Sijmg== + dependencies: + "@sentry-internal/feedback" "7.100.0" + "@sentry-internal/replay-canvas" "7.100.0" + "@sentry-internal/tracing" "7.100.0" + "@sentry/core" "7.100.0" + "@sentry/replay" "7.100.0" + "@sentry/types" "7.100.0" + "@sentry/utils" "7.100.0" + +"@sentry/core@7.100.0": + version "7.100.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.100.0.tgz#5b28c7b3e41e45e4d50e3bdea5d35434fd78e86b" + integrity sha512-eWRPuP0Zdj4a2F7SybqNjf13LGOVgGwvW6sojweQp9oxGAfCPp/EMDGBhlpYbMJeLbzmqzJ4ZFHIedaiEC+7kg== + dependencies: + "@sentry/types" "7.100.0" + "@sentry/utils" "7.100.0" + +"@sentry/replay@7.100.0": + version "7.100.0" + resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.100.0.tgz#4f2e35155626ab286692ade3e31da282c73bd402" + integrity sha512-6Yo56J+x+eedaMXri8pPlFxXOofnSXVdsUuFj+kJ7lC/qHrwIbgC5g1ONEK/WlYwpVH4gA0aNnCa5AOkMu+ZTg== + dependencies: + "@sentry-internal/tracing" "7.100.0" + "@sentry/core" "7.100.0" + "@sentry/types" "7.100.0" + "@sentry/utils" "7.100.0" + +"@sentry/types@7.100.0": + version "7.100.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.100.0.tgz#a16f60d78613bd9810298e9e8d80134be58b24f8" + integrity sha512-c+RHwZwpKeBk7h8sUX4nQcelxBz8ViCojifnbEe3tcn8O15HOLvZqRKgLLOiff3MoErxiv4oxs0sPbEFRm/IvA== + +"@sentry/utils@7.100.0": + version "7.100.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.100.0.tgz#a9d36c01eede117c3e17b0350d399a87934e9c66" + integrity sha512-LAhZMEGq3C125prZN/ShqeXpRfdfgJkl9RAKjfq8cmMFsF7nsF72dEHZgIwrZ0lgNmtaWAB83AwJcyN83RwOxQ== + dependencies: + "@sentry/types" "7.100.0" "@sindresorhus/merge-streams@^1.0.0": version "1.0.0" From bc444108705756e484f2fa0758ba763e2c5b24d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 00:50:03 +0000 Subject: [PATCH 14/27] Bump webmock from 3.19.1 to 3.20.0 (#2179) --- Gemfile.lock | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f5b90ac77..7af4ab4d9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -153,7 +153,8 @@ GEM coderay (1.1.3) concurrent-ruby (1.2.3) connection_pool (2.4.1) - crack (0.4.5) + crack (0.4.6) + bigdecimal rexml crass (1.0.6) css_parser (1.16.0) @@ -208,7 +209,7 @@ GEM gretel (5.0.0) actionview (>= 5.1, < 7.2) railties (>= 5.1, < 7.2) - hashdiff (1.0.1) + hashdiff (1.1.0) htmlbeautifier (1.4.2) htmlentities (4.3.4) i18n (1.14.1) @@ -520,7 +521,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.19.1) + webmock (3.20.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) From cd6d181b526975b7a391af4ee4521a55839709a2 Mon Sep 17 00:00:00 2001 From: Ross Chapman Date: Wed, 7 Feb 2024 15:07:29 -0800 Subject: [PATCH 15/27] =?UTF-8?q?=F0=9F=A7=B9=20`Section`:=20Manage=20`Sec?= =?UTF-8?q?tion#hero=5Fimage`=20as=20an=20independent=20Resource=20(#2164)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../room/hero_images_controller.rb | 26 +++++++++++ app/controllers/rooms_controller.rb | 12 +----- app/lib/space_routes.rb | 1 + app/views/rooms/_form.html.erb | 17 ++------ app/views/rooms/edit.html.erb | 8 ++++ app/views/rooms/hero_image/_form.html.erb | 17 ++++++++ config/locales/room/en.yml | 4 +- config/locales/room/images/en.yml | 10 +++++ db/schema.rb | 4 +- .../hero_images_controller_request_spec.rb | 43 +++++++++++++++++++ 10 files changed, 114 insertions(+), 28 deletions(-) create mode 100644 app/controllers/room/hero_images_controller.rb create mode 100644 app/views/rooms/hero_image/_form.html.erb create mode 100644 config/locales/room/images/en.yml create mode 100644 spec/requests/room/hero_images_controller_request_spec.rb diff --git a/app/controllers/room/hero_images_controller.rb b/app/controllers/room/hero_images_controller.rb new file mode 100644 index 000000000..5d4c59819 --- /dev/null +++ b/app/controllers/room/hero_images_controller.rb @@ -0,0 +1,26 @@ +class Room + class HeroImagesController < ApplicationController + def create + old_hero_image = room.hero_image + new_media = Media.create + new_media.upload.attach(media_params[:upload]) + + if room.update(hero_image: new_media) + old_hero_image&.destroy + flash[:notice] = t(".success", room_name: room.name) + redirect_to [:edit, room.space, room] + else + flash[:notice] = t(".failure", room_name: room.name) + render :new, status: :unprocessable_entity + end + end + + def media_params + params.require(:media).permit(:upload) + end + + helper_method def room + @room ||= authorize(policy_scope(Room).friendly.find(params[:room_id])) + end + end +end diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index 9ea5ac400..adf5a983e 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -25,17 +25,7 @@ def create def update respond_to do |format| - # TODO: Move logic for Media resource management to a dedicated controller (see: https://github.com/zinc-collective/convene/pull/2101/files#r1464115624) - new_media = Media.create - new_media.upload.attach(room_params[:hero_image_upload]) - room_params_for_update = {}.merge( - room_params.except(:hero_image_upload), - { - hero_image: new_media - } - ) - - if room.update(room_params_for_update) + if room.update(room_params) format.html do redirect_to [:edit, room.space], notice: t(".success", room_name: room.name) end diff --git a/app/lib/space_routes.rb b/app/lib/space_routes.rb index 13be49198..6f3891ee4 100644 --- a/app/lib/space_routes.rb +++ b/app/lib/space_routes.rb @@ -8,6 +8,7 @@ def self.append_routes(router) router.resources :rooms, only: %i[show edit update new create destroy] do Furniture.append_routes(router) router.resources :furnitures, only: %i[create edit update destroy] + router.resource :hero_image, controller: "room/hero_images" end router.resources :utilities diff --git a/app/views/rooms/_form.html.erb b/app/views/rooms/_form.html.erb index 478af73ff..76e2ec45e 100644 --- a/app/views/rooms/_form.html.erb +++ b/app/views/rooms/_form.html.erb @@ -1,20 +1,11 @@ -<%= render CardComponent.new do %> +<%= render CardComponent.new do |card| %> + <%- card.with_header do %> +

Basic info

+ <%- end %> <%= form_with model: room.location do |room_form| %> <%= render "text_field", attribute: :name, form: room_form %> <%= render "text_field", attribute: :slug, form: room_form %> <%= render "text_area", attribute: :description, form: room_form, label_hint: 'Add brief summary of your section for search engines to display as snippets in results' %> - <%- if room.hero_image&.upload&.attached? %> -
- <%= image_tag room.hero_image&.upload %> -
- <% end %> - <%= render "file_field", - attribute: :hero_image_upload, - form: room_form, - label: "Upload a header image", - label_hint: "Images are great for marketing!", - required: false - %>

Privacy and Security

<%= render "radio_group", attribute: :access_level, options: Room::access_levels.values, form: room_form %>