Merge branch 'main' into popup-disabled-buttons-no-pointer-events

This commit is contained in:
Alexander Zaytsev
2026-01-14 17:25:24 +01:00
25 changed files with 396 additions and 87 deletions
+31 -32
View File
@@ -123,8 +123,8 @@ GEM
ast (2.4.3)
autotuner (1.1.0)
aws-eventstream (1.4.0)
aws-partitions (1.1197.0)
aws-sdk-core (3.240.0)
aws-partitions (1.1203.0)
aws-sdk-core (3.241.3)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
@@ -132,28 +132,28 @@ GEM
bigdecimal
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-kms (1.118.0)
aws-sdk-core (~> 3, >= 3.239.1)
aws-sdk-kms (1.120.0)
aws-sdk-core (~> 3, >= 3.241.3)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.208.0)
aws-sdk-core (~> 3, >= 3.234.0)
aws-sdk-s3 (1.211.0)
aws-sdk-core (~> 3, >= 3.241.3)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.12.1)
aws-eventstream (~> 1, >= 1.0.2)
base64 (0.3.0)
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.1)
bcrypt (3.1.21)
bcrypt_pbkdf (1.1.2)
benchmark (0.5.0)
bigdecimal (4.0.1)
bindex (0.8.1)
bootsnap (1.19.0)
bootsnap (1.20.1)
msgpack (~> 1.2)
brakeman (7.1.1)
brakeman (7.1.2)
racc
builder (3.3.0)
bundler-audit (0.9.2)
bundler (>= 1.2.0, < 3)
bundler-audit (0.9.3)
bundler (>= 1.2.0)
thor (~> 1.0)
capybara (3.40.0)
addressable
@@ -168,23 +168,23 @@ GEM
logger (~> 1.5)
chunky_png (1.4.0)
concurrent-ruby (1.3.6)
connection_pool (2.5.5)
connection_pool (3.0.2)
crack (1.0.1)
bigdecimal
rexml
crass (1.0.6)
date (3.5.1)
debug (1.11.0)
debug (1.11.1)
irb (~> 1.10)
reline (>= 0.3.8)
dotenv (3.1.8)
dotenv (3.2.0)
drb (2.2.3)
ed25519 (1.4.0)
erb (6.0.1)
erubi (1.13.1)
et-orbi (1.4.0)
tzinfo
faker (3.5.2)
faker (3.5.3)
i18n (>= 1.8.11, < 2)
ffi (1.17.2-aarch64-linux-gnu)
ffi (1.17.2-aarch64-linux-musl)
@@ -224,7 +224,7 @@ GEM
json (2.18.0)
jwt (3.1.2)
base64
kamal (2.9.0)
kamal (2.10.1)
activesupport (>= 7.0)
base64 (~> 0.2)
bcrypt_pbkdf (~> 1.0)
@@ -271,11 +271,11 @@ GEM
stimulus-rails
turbo-rails
mittens (0.3.1)
mocha (2.8.2)
mocha (3.0.1)
ruby2_keywords (>= 0.0.5)
msgpack (1.8.0)
net-http-persistent (4.0.6)
connection_pool (~> 2.2, >= 2.2.4)
net-http-persistent (4.0.8)
connection_pool (>= 2.2.4, < 4)
net-imap (0.6.2)
date
net-protocol
@@ -307,7 +307,7 @@ GEM
racc (~> 1.4)
nokogiri (1.19.0-x86_64-linux-musl)
racc (~> 1.4)
openssl (3.3.2)
openssl (4.0.0)
ostruct (0.6.3)
parallel (1.27.0)
parser (3.3.10.0)
@@ -319,7 +319,7 @@ GEM
pp (0.6.3)
prettyprint
prettyprint (0.2.0)
prism (1.6.0)
prism (1.8.0)
propshaft (1.3.1)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
@@ -360,11 +360,11 @@ GEM
reline (0.6.3)
io-console (~> 0.5)
rexml (3.4.4)
rouge (4.6.1)
rqrcode (3.1.0)
rouge (4.7.0)
rqrcode (3.2.0)
chunky_png (~> 1.0)
rqrcode_core (~> 2.0)
rqrcode_core (2.0.0)
rqrcode_core (2.1.0)
rubocop (1.81.7)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
@@ -400,7 +400,7 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (3.2.2)
securerandom (0.4.1)
selenium-webdriver (4.38.0)
selenium-webdriver (4.39.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
@@ -430,7 +430,7 @@ GEM
sqlite3 (2.8.0-x86_64-darwin)
sqlite3 (2.8.0-x86_64-linux-gnu)
sqlite3 (2.8.0-x86_64-linux-musl)
sshkit (1.24.0)
sshkit (1.25.0)
base64
logger
net-scp (>= 1.1.2)
@@ -440,7 +440,7 @@ GEM
stimulus-rails (1.3.4)
railties (>= 6.0.0)
stringio (3.2.0)
thor (1.4.0)
thor (1.5.0)
thruster (0.1.17)
thruster (0.1.17-aarch64-linux)
thruster (0.1.17-arm64-darwin)
@@ -458,16 +458,15 @@ GEM
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
uri (1.1.1)
vcr (6.3.1)
base64
vcr (6.4.0)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
web-push (3.0.2)
web-push (3.1.0)
jwt (~> 3.0)
openssl (~> 3.0)
openssl (>= 3.0)
webmock (3.26.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
+31 -32
View File
@@ -201,8 +201,8 @@ GEM
ast (2.4.3)
autotuner (1.1.0)
aws-eventstream (1.4.0)
aws-partitions (1.1197.0)
aws-sdk-core (3.240.0)
aws-partitions (1.1203.0)
aws-sdk-core (3.241.3)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
@@ -210,28 +210,28 @@ GEM
bigdecimal
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-kms (1.118.0)
aws-sdk-core (~> 3, >= 3.239.1)
aws-sdk-kms (1.120.0)
aws-sdk-core (~> 3, >= 3.241.3)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.208.0)
aws-sdk-core (~> 3, >= 3.234.0)
aws-sdk-s3 (1.211.0)
aws-sdk-core (~> 3, >= 3.241.3)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.12.1)
aws-eventstream (~> 1, >= 1.0.2)
base64 (0.3.0)
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.1)
bcrypt (3.1.21)
bcrypt_pbkdf (1.1.2)
benchmark (0.5.0)
bigdecimal (4.0.1)
bindex (0.8.1)
bootsnap (1.19.0)
bootsnap (1.20.1)
msgpack (~> 1.2)
brakeman (7.1.1)
brakeman (7.1.2)
racc
builder (3.3.0)
bundler-audit (0.9.2)
bundler (>= 1.2.0, < 3)
bundler-audit (0.9.3)
bundler (>= 1.2.0)
thor (~> 1.0)
capybara (3.40.0)
addressable
@@ -246,16 +246,16 @@ GEM
logger (~> 1.5)
chunky_png (1.4.0)
concurrent-ruby (1.3.6)
connection_pool (2.5.5)
connection_pool (3.0.2)
crack (1.0.1)
bigdecimal
rexml
crass (1.0.6)
date (3.5.1)
debug (1.11.0)
debug (1.11.1)
irb (~> 1.10)
reline (>= 0.3.8)
dotenv (3.1.8)
dotenv (3.2.0)
drb (2.2.3)
dry-initializer (3.2.0)
ed25519 (1.4.0)
@@ -263,7 +263,7 @@ GEM
erubi (1.13.1)
et-orbi (1.4.0)
tzinfo
faker (3.5.2)
faker (3.5.3)
i18n (>= 1.8.11, < 2)
ffi (1.17.2-aarch64-linux-gnu)
ffi (1.17.2-aarch64-linux-musl)
@@ -302,7 +302,7 @@ GEM
json (2.18.0)
jwt (3.1.2)
base64
kamal (2.9.0)
kamal (2.10.1)
activesupport (>= 7.0)
base64 (~> 0.2)
bcrypt_pbkdf (~> 1.0)
@@ -349,11 +349,11 @@ GEM
stimulus-rails
turbo-rails
mittens (0.3.1)
mocha (2.8.2)
mocha (3.0.1)
ruby2_keywords (>= 0.0.5)
msgpack (1.8.0)
net-http-persistent (4.0.6)
connection_pool (~> 2.2, >= 2.2.4)
net-http-persistent (4.0.8)
connection_pool (>= 2.2.4, < 4)
net-imap (0.6.2)
date
net-protocol
@@ -383,7 +383,7 @@ GEM
racc (~> 1.4)
nokogiri (1.19.0-x86_64-linux-musl)
racc (~> 1.4)
openssl (3.3.2)
openssl (4.0.0)
ostruct (0.6.3)
parallel (1.27.0)
parser (3.3.10.0)
@@ -395,7 +395,7 @@ GEM
pp (0.6.3)
prettyprint
prettyprint (0.2.0)
prism (1.6.0)
prism (1.8.0)
prometheus-client-mmap (1.4.0)
base64
bigdecimal
@@ -470,11 +470,11 @@ GEM
io-console (~> 0.5)
rexml (3.4.4)
rinku (2.0.6)
rouge (4.6.1)
rqrcode (3.1.0)
rouge (4.7.0)
rqrcode (3.2.0)
chunky_png (~> 1.0)
rqrcode_core (~> 2.0)
rqrcode_core (2.0.0)
rqrcode_core (2.1.0)
rubocop (1.81.7)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
@@ -511,7 +511,7 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (3.2.2)
securerandom (0.4.1)
selenium-webdriver (4.38.0)
selenium-webdriver (4.39.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
@@ -549,7 +549,7 @@ GEM
sqlite3 (2.8.0-arm64-darwin)
sqlite3 (2.8.0-x86_64-linux-gnu)
sqlite3 (2.8.0-x86_64-linux-musl)
sshkit (1.24.0)
sshkit (1.25.0)
base64
logger
net-scp (>= 1.1.2)
@@ -560,7 +560,7 @@ GEM
railties (>= 6.0.0)
stringio (3.2.0)
stripe (18.0.1)
thor (1.4.0)
thor (1.5.0)
thruster (0.1.17)
thruster (0.1.17-aarch64-linux)
thruster (0.1.17-arm64-darwin)
@@ -577,16 +577,15 @@ GEM
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
uri (1.1.1)
vcr (6.3.1)
base64
vcr (6.4.0)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
web-push (3.0.2)
web-push (3.1.0)
jwt (~> 3.0)
openssl (~> 3.0)
openssl (>= 3.0)
webmock (3.26.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
+1
View File
@@ -849,6 +849,7 @@
--btn-background: var(--card-color);
color: var(--color-ink-inverted);
opacity: 1 !important;
@media (hover: hover) {
&:hover {
+7
View File
@@ -109,6 +109,13 @@
&:not:has(lexxy-editor) {
padding-inline-end: var(--reaction-size);
}
/* Add an empty space so the last line of text doesn't overlap with the reaction button */
.action-text-content > p:last-child::after {
content: "";
display: inline-block;
inline-size: var(--reaction-size);
}
}
.comment__content {
+1
View File
@@ -24,6 +24,7 @@
.txt-underline { text-decoration: underline; }
.txt-tight-lines { line-height: 1.2; }
.txt-nowrap { white-space: nowrap; }
.txt-balance { text-wrap: balance; }
.txt-break { word-break: break-word; }
.txt-uppercase { text-transform: uppercase; }
.txt-capitalize { text-transform: capitalize; }
+1 -1
View File
@@ -8,7 +8,7 @@ class Users::AvatarsController < ApplicationController
if @user.system?
redirect_to view_context.image_path("system_user.png")
elsif @user.avatar.attached?
redirect_to rails_blob_url(@user.avatar_thumbnail, disposition: "inline")
redirect_to rails_blob_path(@user.avatar_thumbnail, disposition: "inline")
elsif stale? @user, cache_control: cache_control
render_initials
end
+1 -1
View File
@@ -42,6 +42,6 @@ module AvatarsHelper
end
def avatar_image_tag(user, **options)
image_tag user_avatar_url(user, script_name: user.account.slug), aria: { hidden: "true" }, size: 48, title: user.name, **options
image_tag user_avatar_path(user, script_name: user.account.slug), aria: { hidden: "true" }, size: 48, title: user.name, **options
end
end
+1
View File
@@ -5,6 +5,7 @@ module ColumnsHelper
card_triage_path(card, column_id: column),
method: :post,
class: [ "card__column-name btn", { "card__column-name--current": column == card.column && card.open? } ],
disabled: column == card.column,
style: "--column-color: #{column.color}",
form_class: "flex gap-half",
data: { turbo_frame: "_top", scroll_to_target: column == card.column && card.open? ? "target" : nil }
@@ -14,13 +14,12 @@ export default class extends Controller {
}
async connect() {
await this.#restoreColumnsDisablingTransitions()
this.#setupIntersectionObserver()
this.mediaQuery = window.matchMedia(this.desktopBreakpointValue)
this.handleDesktop = this.#handleDesktop.bind(this)
this.mediaQuery.addEventListener("change", this.handleDesktop)
this.handleDesktop(this.mediaQuery)
await this.#restoreColumnsDisablingTransitions()
this.#setupIntersectionObserver()
}
disconnect() {
@@ -57,6 +56,7 @@ export default class extends Controller {
async #restoreColumnsDisablingTransitions() {
this.#disableTransitions()
this.#restoreColumns()
this.#handleDesktop()
await nextFrame()
this.#enableTransitions()
+5
View File
@@ -46,6 +46,7 @@ module Board::Accessible
mentions_for_user(user).destroy_all
notifications_for_user(user).destroy_all
watches_for(user).destroy_all
pins_for(user).destroy_all
end
def watchers
@@ -99,4 +100,8 @@ module Board::Accessible
def watches_for(user)
Watch.where(card: cards, user: user)
end
def pins_for(user)
Pin.where(card: cards, user: user)
end
end
@@ -12,14 +12,14 @@
height: height %>
<% elsif blob.audio? %>
<audio controls="true" width="100%" preload="metadata">
<source src="<%= rails_blob_url(blob) %>" type="<%= blob.content_type %>">
<source src="<%= rails_blob_path(blob) %>" type="<%= blob.content_type %>">
</audio>
<% elsif blob.variable? %>
<%= link_to url_for(blob.variant(variant)), data: { lightbox_target: "image", lightbox_caption_value: blob.filename.to_s } do %>
<%= image_tag url_for(blob.variant(variant)), width: width, height: height %>
<%= link_to rails_representation_path(blob.variant(variant)), data: { lightbox_target: "image", lightbox_caption_value: blob.filename.to_s } do %>
<%= image_tag rails_representation_path(blob.variant(variant)), width: width, height: height %>
<% end %>
<% elsif blob.previewable? %>
<%= image_tag url_for(blob.preview(variant)), width: width, height: height %>
<%= image_tag rails_representation_path(blob.preview(variant)), width: width, height: height %>
<% else %>
<span class="attachment__icon"><%= blob.filename.extension&.downcase.presence || "unknown" %></span>
<% end %>
+2 -2
View File
@@ -1,7 +1,7 @@
<%= turbo_frame_tag @board, :entropy do %>
<%= turbo_frame_tag board, :entropy do %>
<div class="margin-block-end">
<h2 class="divider txt-large">Auto close</h2>
<p class="margin-none-block-start">Fizzy doesnt let stale cards stick around forever. Cards automatically move to “Not now” if no one updates, comments, or moves a card for…</p>
<%= render "entropy/auto_close", model: board, url: board_entropy_path(board), disabled: !Current.user.can_administer_board?(@board) %>
<%= render "entropy/auto_close", model: board, url: board_entropy_path(board), disabled: !Current.user.can_administer_board?(board) %>
</div>
<% end %>
+4 -1
View File
@@ -5,6 +5,7 @@
<%= button_to "Not now", card_not_now_path(@card),
class: [ "card__column-name btn", { "card__column-name--current": @card.postponed? } ],
style: "--column-color: var(--color-card-complete)",
disabled: @card.postponed?,
role: "radio",
aria: { checked: @card.postponed? },
data: { scroll_to_target: @card.postponed? ? "target" : nil },
@@ -12,7 +13,8 @@
<%= button_to "Maybe?", card_triage_path(@card), method: :delete,
class: [ "card__column-name card__column-name--stream btn", { "card__column-name--current": @card.awaiting_triage? } ],
style: "--column-color: var(--color-card-default)",
style: "--column-color: var(--color-card-default)",
disabled: @card.awaiting_triage?,
role: "radio",
aria: { checked: @card.awaiting_triage? },
data: { scroll_to_target: @card.awaiting_triage? ? "target" : nil },
@@ -25,6 +27,7 @@
<%= button_to "Done", card_closure_path(@card),
class: [ "card__column-name btn", { "card__column-name--current": @card.closed? } ],
style: "--column-color: var(--color-card-complete)",
disabled: @card.closed?,
role: "radio",
aria: { checked: @card.closed? },
data: { scroll_to_target: @card.closed? ? "target" : nil },
@@ -3,9 +3,9 @@
<% height = attachment.metadata["height"] %>
<% if attachment.previewable? %>
<%= image_tag url_for(attachment.preview(variant)), class: "attachment attachment--image", width: width, height: height %>
<%= image_tag rails_representation_path(attachment.preview(variant)), class: "attachment attachment--image", width: width, height: height %>
<% elsif attachment.variable? %>
<%= image_tag url_for(attachment.variant(variant)), class: "attachment attachment--image", width: width, height: height %>
<%= image_tag rails_representation_path(attachment.variant(variant)), class: "attachment attachment--image", width: width, height: height %>
<% else %>
<div class="attachment attachment--file attachment--<%= attachment.filename.extension -%>">
<span class="attachment__icon"><%= attachment.filename.extension&.downcase.presence || "unknown" %></span>
+1 -1
View File
@@ -3,7 +3,7 @@
<%= collapsible_nav_section "Accounts" do %>
<%# Bust cache 1 Dec 2025 %>
<% accounts.each do |account| %>
<%= filter_place_menu_item landing_url(script_name: account.slug), account.name, "marker", current: account == Current.account, turbo: false %>
<%= filter_place_menu_item landing_path(script_name: account.slug), account.name, "marker", current: account == Current.account, turbo: false %>
<% end %>
<% end %>
<% end %>
+1 -1
View File
@@ -6,7 +6,7 @@
<%= tag.li class: "popup__item", data: { filter_target: "item", navigable_list_target: "item" } do %>
<%= icon_tag "logout", class: "popup__icon" %>
<%= button_to session_url(script_name: nil), method: :delete, class: "popup__btn btn", data: { turbo: false } do %>
<%= button_to session_path(script_name: nil), method: :delete, class: "popup__btn btn", data: { turbo: false } do %>
<span>Sign out</span>
<% end %>
<% end %>
+1 -1
View File
@@ -3,6 +3,6 @@
#<%= card.number %> <%= card.title %>
</template>
<template type="editor">
<%= link_to "##{card.number} #{card.title}", card_url(card) %>
<%= link_to "##{card.number} #{card.title}", card_path(card) %>
</template>
</lexxy-prompt-item>
+2 -2
View File
@@ -3,7 +3,7 @@
<div class="panel panel--centered flex flex-column gap-half <%= "shake" if flash[:alert] || flash[:shake] %>">
<header>
<h1 class="txt-x-large font-weight-black margin-none"><%= @page_title %></h1>
<p class="margin-none-block-start txt-medium">
<p class="margin-none-block-start txt-medium txt-balance">
Then enter the verification code included in the email below:
</p>
</header>
@@ -15,7 +15,7 @@
data: { magic_link_target: "input", action: "keydown.enter->magic-link#submitOnEnter paste->magic-link#submitOnPaste" } %>
<% end %>
<p class="txt-small">The code sent to <strong><%= email_address_pending_authentication %></strong> will work for <%= distance_of_time_in_words(MagicLink::EXPIRATION_TIME) %>.</p>
<p class="txt-small txt-balance">The code sent to <strong><%= email_address_pending_authentication %></strong> will work for <%= distance_of_time_in_words(MagicLink::EXPIRATION_TIME) %>.</p>
</div>
<% if Rails.env.development? && flash[:magic_link_code].present? %>
+1 -1
View File
@@ -13,7 +13,7 @@
<% @accounts.each do |account| %>
<li class="popup__item txt-medium">
<%= icon_tag "marker", class: "popup__icon" %>
<%= link_to landing_url(script_name: account.slug), class: "btn overflow-ellipsis fill-transparent popup__btn" do %>
<%= link_to landing_path(script_name: account.slug), class: "btn overflow-ellipsis fill-transparent popup__btn" do %>
<strong><%= account.name %></strong>
<% end %>
</li>
+1 -1
View File
@@ -41,7 +41,7 @@
<% if Current.user == @user %>
<hr class="separator--horizontal full-width flex-item-grow margin-block-start-double" style="--border-color: var(--color-ink-light);" aria-hidden="true">
<%= button_to session_url(script_name: nil), method: :delete, class: "btn txt-x-small center", data: { turbo: false } do %>
<%= button_to session_path(script_name: nil), method: :delete, class: "btn txt-x-small center", data: { turbo: false } do %>
<span>Sign out of Fizzy on this device</span>
<% end %>
<% end %>
+1 -1
View File
@@ -1,4 +1,4 @@
<%= @event.description_for(Current.user).to_plain_text %>
<% if @event.eventable %>
<%= link_to "↗︎", polymorphic_url(@event.eventable) %>
<%= link_to "↗︎", polymorphic_url(@event.eventable, only_path: true) %>
<% end %>
+11
View File
@@ -8,6 +8,17 @@ ActiveSupport.on_load(:active_storage_blob) do
end
end
ActiveSupport.on_load(:action_text_content) do
# Install our extensions after ActionText::Engine's
ActiveSupport.on_load(:active_storage_blob) do
# Ensure all <action-text-attachment>s have a "url" attribute that's a relative
# path (for portability across host name changes, beta environments, etc).
def to_rich_text_attributes(*)
super.merge url: Rails.application.routes.url_helpers.polymorphic_url(self, only_path: true)
end
end
end
# Don't configure replica connections for ActiveStorage::Record.
# When ActiveStorage uses `connects_to`, it creates a separate connection pool
# from ApplicationRecord. This causes after_commit callbacks to fire in
@@ -0,0 +1,132 @@
#!/usr/bin/env ruby
# Convert absolute attachment URLs in rich text content to relative paths.
# This fixes URLs that were stored with full hostnames (e.g., https://app.fizzy.do/...)
# making them portable across beta environments and host changes.
#
# MUST BE RUN AFTER `decrypt!` when using ActiveRecord Encryption
#
# Run locally:
# bin/rails runner script/migrations/convert-absolute-attachment-urls-to-relative.rb --help
#
# Run via Kamal:
# kamal app exec -d <stage> -p --reuse "bin/rails runner script/migrations/convert-absolute-attachment-urls-to-relative.rb --help"
#
# Safe to re-run: won't modify already-relative URLs
class ConvertAbsoluteAttachmentUrlsToRelative
# Match absolute URLs pointing to Active Storage routes, keeping the account slug
ABSOLUTE_URL_PATTERN = %r{https?://[^/]+(/\d+/rails/active_storage/[^"']+)}
attr_reader :account, :dry_run
def initialize(account_id: nil, dry_run: false)
@account = Account.find_by(external_account_id: account_id)
@dry_run = dry_run
end
def run
puts "Converting absolute attachment URLs to relative paths"
puts dry_run ? "DRY RUN MODE - no changes will be saved" : "LIVE MODE - changes will be saved"
puts account ? "Only account: #{account.external_account_id} - #{account.name}" : "For **ALL ACCOUNTS**"
puts "\nPress ENTER to continue running or CTRL-C to bail..."
gets
puts "\nRunning..."
# Suppress SQL logs
Rails.event.debug_mode = false
seconds = Benchmark.realtime do
suppressing_turbo_broadcasts do
convert_urls
end
end
puts "\n\n"
puts "Finished in %.2f seconds." % seconds
end
private
def suppressing_turbo_broadcasts
Board.suppressing_turbo_broadcasts do
Card.suppressing_turbo_broadcasts do
yield
end
end
end
def convert_urls
scanned = 0
fixed = 0
urls_converted = 0
action_texts_scope.find_each do |rich_text|
scanned += 1
body = rich_text.body
edited = false
conversions = 0
body.send(:attachment_nodes).each do |node|
url = node["url"]
next unless url
if url.match?(ABSOLUTE_URL_PATTERN)
node["url"] = url.gsub(ABSOLUTE_URL_PATTERN, '\1')
edited = true
conversions += 1
end
end
if edited
record = rich_text.record
puts " - modifying #{record.class.name} #{record.to_param} (account: #{record.account&.external_account_id}) - #{conversions} URL(s)"
unless dry_run
rich_text.update! body: body.fragment.to_html
end
fixed += 1
urls_converted += conversions
end
end
puts "\n\nConversion complete!"
puts " Rich texts examined: #{scanned}"
puts " Rich texts modified: #{fixed}"
puts " URLs converted: #{urls_converted}"
end
def action_texts_scope
# Only examine rich texts that have embedded attachments
scope = ActionText::RichText.joins(:embeds_attachments)
scope = scope.where(account: account) if account
scope
end
end
require "optparse"
options = { account_id: nil, dry_run: true }
OptionParser.new do |opts|
opts.banner = "Usage: bin/rails runner #{__FILE__} [options]"
opts.on("-a", "--account ACCOUNT_ID", "Restrict to a specific account (external_account_id)") do |id|
options[:account_id] = id
end
opts.on("--[no-]dry-run", "Run in dry-run mode (default: --dry-run)") do |v|
options[:dry_run] = v
end
opts.on("-h", "--help", "Show this help message") do
puts opts
exit
end
end.parse!
ConvertAbsoluteAttachmentUrlsToRelative.new(**options).run
@@ -0,0 +1,127 @@
#!/usr/bin/env ruby
# Rollback script: Convert relative attachment URLs back to absolute URLs.
# Use this if you need to rollback the relative URL changes and want to
# convert rich texts created during the rollout back to absolute URLs.
#
# Run locally:
# bin/rails runner script/migrations/convert-relative-attachment-urls-to-absolute.rb --help
#
# Run via Kamal:
# kamal app exec -d <stage> -p --reuse "bin/rails runner script/migrations/convert-relative-attachment-urls-to-absolute.rb --help"
class ConvertRelativeAttachmentUrlsToAbsolute
# Match relative URLs pointing to Active Storage routes (with account slug)
RELATIVE_URL_PATTERN = %r{\A(/\d+/rails/active_storage/[^"']+)\z}
attr_reader :host, :since
def initialize(host:, since:)
@host = host
@since = since
end
def run
puts "Converting relative attachment URLs to absolute URLs"
puts "Host: #{host}"
puts "Processing rich texts created since: #{since}"
puts "\nPress ENTER to continue running or CTRL-C to bail..."
gets
puts "\nRunning..."
seconds = Benchmark.realtime do
suppressing_turbo_broadcasts do
convert_urls
end
end
puts "\n\n"
puts "Finished in %.2f seconds." % seconds
end
private
def suppressing_turbo_broadcasts
Board.suppressing_turbo_broadcasts do
Card.suppressing_turbo_broadcasts do
yield
end
end
end
def convert_urls
scanned = 0
fixed = 0
urls_converted = 0
action_texts_scope.find_each do |rich_text|
scanned += 1
body = rich_text.body
edited = false
conversions = 0
body.send(:attachment_nodes).each do |node|
url = node["url"]
next unless url
if url.match?(RELATIVE_URL_PATTERN)
node["url"] = "#{host}#{url}"
edited = true
conversions += 1
end
end
if edited
record = rich_text.record
puts " - modifying #{record.class.name} #{record.to_param} (account: #{record.account&.external_account_id}) - #{conversions} URL(s)"
rich_text.update! body: body.fragment.to_html
fixed += 1
urls_converted += conversions
end
end
puts "\n\nConversion complete!"
puts " Rich texts examined: #{scanned}"
puts " Rich texts modified: #{fixed}"
puts " URLs converted: #{urls_converted}"
end
def action_texts_scope
ActionText::RichText.joins(:embeds_attachments).where("action_text_rich_texts.created_at >= ?", since)
end
end
require "optparse"
require "time"
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: bin/rails runner #{__FILE__} [options]"
opts.on("--host HOST", "Host to prepend (e.g., https://app.fizzy.do)") do |host|
options[:host] = host
end
opts.on("--since TIME", "Process rich texts created since this time (ISO 8601 format)") do |time|
options[:since] = Time.parse(time)
end
opts.on("-h", "--help", "Show this help message") do
puts opts
exit
end
end.parse!
if options[:host].nil? || options[:since].nil?
puts "Error: --host and --since are required"
puts "Example: bin/rails runner #{__FILE__} --host https://app.fizzy.do --since 2026-01-14T10:00:00Z"
exit 1
end
ConvertRelativeAttachmentUrlsToAbsolute.new(**options).run
+23
View File
@@ -80,4 +80,27 @@ class AccessTest < ActiveSupport::TestCase
assert_not card.watched_by?(kevin)
end
test "pins are destroyed when access is lost" do
kevin = users(:kevin)
board = boards(:writebook)
card = cards(:logo) # Kevin has pinned this card
other_board = boards(:miltons_wish_list)
other_card = cards(:radio)
other_board.accesses.grant_to(kevin)
other_card.pin_by(kevin)
assert card.pinned_by?(kevin)
assert other_card.pinned_by?(kevin)
kevin_access = accesses(:writebook_kevin)
perform_enqueued_jobs only: Board::CleanInaccessibleDataJob do
kevin_access.destroy
end
assert_not card.pinned_by?(kevin)
assert other_card.pinned_by?(kevin), "Pin on other board should not be destroyed"
end
end