diff --git a/app/assets/stylesheets/card-perma.css b/app/assets/stylesheets/card-perma.css
index 407b1beac..6d966d0ae 100644
--- a/app/assets/stylesheets/card-perma.css
+++ b/app/assets/stylesheets/card-perma.css
@@ -543,12 +543,4 @@
}
}
}
-
- .card-perma__account-limit-message {
- background-color: var(--color-canvas);
- border: 2px solid var(--color-container);
- border-radius: 4px;
- margin-block-start: calc(var(--padding-block) / -2);
- padding: 1ch 2ch;
- }
}
diff --git a/app/assets/stylesheets/comments.css b/app/assets/stylesheets/comments.css
index 21578572b..2369d62b3 100644
--- a/app/assets/stylesheets/comments.css
+++ b/app/assets/stylesheets/comments.css
@@ -1,7 +1,4 @@
@layer components {
- /* List
- /* ------------------------------------------------------------------------ */
-
.comments {
--avatar-size: 2.33em;
--comment-padding-block: var(--block-space-half);
@@ -24,8 +21,10 @@
}
}
- /* Comment
- /* ------------------------------------------------------------------------ */
+ .comments__subscribers {
+ max-inline-size: var(--comment-max);
+ padding-inline: calc(var(--comment-padding-block) + var(--inline-space-double));
+ }
.comment {
/* Distinguish from the .comment class used for code formatting without extra specificity */
@@ -36,6 +35,52 @@
position: relative;
}
+ .comment-by-system & {
+ --comment-padding-block: var(--block-space-half);
+
+ text-align: center;
+
+ &::before {
+ /* Make up space for lack of avatar */
+ content: "";
+ display: flex;
+ inline-size: calc(var(--comment-padding-inline) * 0.9);
+ }
+
+ .comment__avatar {
+ display: none;
+ }
+
+ .comment__author {
+ a { margin: 0 auto; }
+ h3 { margin-inline: auto; }
+ strong { display: none; }
+ }
+
+ .comment__body {
+ padding: 0;
+ text-align: center;
+ }
+
+ .comment__content {
+ --stripe-color: var(--color-ink-lightest);
+
+ background-image: repeating-linear-gradient(
+ 45deg in srgb,
+ var(--color-canvas) 0 1px,
+ var(--stripe-color) 1px 10px);
+ padding-inline: var(--comment-padding-inline);
+
+ .comments--system-expanded .comment-by-system & {
+ --stripe-color: color-mix(in srgb, var(--card-color) 10%, var(--color-canvas));
+ }
+ }
+
+ .reactions {
+ display: none !important;
+ }
+ }
+
.reactions {
margin-block-start: var(--block-space-half);
margin-inline: calc(var(--column-gap) / -1);
@@ -150,12 +195,7 @@
}
}
- /* System comment
- /* ------------------------------------------------------------------------ */
-
.comment-by-system {
- --stripe-color: var(--color-ink-lightest);
-
display: none;
transition: var(--dialog-duration) allow-discrete;
transition-property: display;
@@ -163,50 +203,6 @@
.comments--system-expanded & {
display: contents;
}
-
- .comment {
- --comment-padding-block: var(--block-space-half);
-
- text-align: center;
-
- &::before {
- /* Make up space for lack of avatar */
- content: "";
- display: flex;
- inline-size: calc(var(--comment-padding-inline) * 0.9);
- }
- }
-
- .comment__avatar {
- display: none;
- }
-
- .comment__author {
- a { margin: 0 auto; }
- h3 { margin-inline: auto; }
- strong { display: none; }
- }
-
- .comment__body {
- padding: 0;
- text-align: center;
- }
-
- .comment__content {
- background-image: repeating-linear-gradient(
- 45deg in srgb,
- var(--color-canvas) 0 1px,
- var(--stripe-color) 1px 10px);
- padding-inline: var(--comment-padding-inline);
-
- .comments--system-expanded .comment-by-system & {
- --stripe-color: color-mix(in srgb, var(--card-color) 10%, var(--color-canvas));
- }
- }
-
- .reactions {
- display: none !important;
- }
}
/* Show the last system comment */
@@ -224,20 +220,4 @@
display: none;
}
}
-
- .comment-by-system--account-limit {
- --stripe-color: oklch(var(--lch-blue-lightest));
-
- .comment__content {
- padding: 3ch;
- }
- }
-
- /* Subscribers
- /* ------------------------------------------------------------------------ */
-
- .comments__subscribers {
- max-inline-size: var(--comment-max);
- padding-inline: calc(var(--comment-padding-block) + var(--inline-space-double));
- }
}
diff --git a/app/views/cards/_messages.html.erb b/app/views/cards/_messages.html.erb
index c51ab6d8b..a2784e72a 100644
--- a/app/views/cards/_messages.html.erb
+++ b/app/views/cards/_messages.html.erb
@@ -1,11 +1,7 @@
<%= messages_tag(card) do %>
<% if card.published? %>
<%= render partial: "cards/comments/comment", collection: card.comments.preloaded.chronologically, cached: true %>
- <% if Fizzy.saas? %>
- <%= render "cards/comments/saas/new", card: card %>
- <% else %>
- <%= render "cards/comments/new", card: card %>
- <% end %>
+ <%= render "cards/comments/new", card: card %>
<%= render "cards/comments/watchers", card: card %>
<% end %>
diff --git a/app/views/cards/container/footer/_create.html.erb b/app/views/cards/container/footer/_create.html.erb
index 4e5a83e20..648beffd1 100644
--- a/app/views/cards/container/footer/_create.html.erb
+++ b/app/views/cards/container/footer/_create.html.erb
@@ -13,7 +13,5 @@
Create and add another
<% end %>
-
- <%= render "cards/container/footer/saas/storage_limit_notice" if Fizzy.saas? %>
diff --git a/app/views/cards/drafts/_container.html.erb b/app/views/cards/drafts/_container.html.erb
index fa7134b55..9ffc04711 100644
--- a/app/views/cards/drafts/_container.html.erb
+++ b/app/views/cards/drafts/_container.html.erb
@@ -26,9 +26,5 @@
<% end %>
- <% if Fizzy.saas? %>
- <%= render "cards/container/footer/saas/create", card: card %>
- <% else %>
- <%= render "cards/container/footer/create", card: card %>
- <% end %>
+ <%= render "cards/container/footer/create", card: card %>
diff --git a/saas/app/controllers/concerns/card/storage_limited.rb b/saas/app/controllers/concerns/card/storage_limited.rb
deleted file mode 100644
index 05357f43f..000000000
--- a/saas/app/controllers/concerns/card/storage_limited.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-module Card::StorageLimited
- extend ActiveSupport::Concern
-
- private
- def ensure_within_storage_limit
- head :forbidden if Current.account.exceeding_storage_limit?
- end
-end
diff --git a/saas/app/controllers/concerns/card/storage_limited/commenting.rb b/saas/app/controllers/concerns/card/storage_limited/commenting.rb
deleted file mode 100644
index a4b7e3307..000000000
--- a/saas/app/controllers/concerns/card/storage_limited/commenting.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module Card::StorageLimited::Commenting
- extend ActiveSupport::Concern
-
- included do
- include Card::StorageLimited
-
- before_action :ensure_within_storage_limit, only: :create
- end
-end
diff --git a/saas/app/controllers/concerns/card/storage_limited/creation.rb b/saas/app/controllers/concerns/card/storage_limited/creation.rb
deleted file mode 100644
index 9d894779d..000000000
--- a/saas/app/controllers/concerns/card/storage_limited/creation.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module Card::StorageLimited::Creation
- extend ActiveSupport::Concern
-
- included do
- include Card::StorageLimited
-
- before_action :ensure_within_storage_limit, only: :create, if: -> { request.format.json? }
- end
-end
diff --git a/saas/app/controllers/concerns/card/storage_limited/publishing.rb b/saas/app/controllers/concerns/card/storage_limited/publishing.rb
deleted file mode 100644
index abf7731a4..000000000
--- a/saas/app/controllers/concerns/card/storage_limited/publishing.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module Card::StorageLimited::Publishing
- extend ActiveSupport::Concern
-
- included do
- include Card::StorageLimited
-
- before_action :ensure_within_storage_limit, only: :create
- end
-end
diff --git a/saas/app/models/account/storage_limited.rb b/saas/app/models/account/storage_limited.rb
deleted file mode 100644
index dbab32b5d..000000000
--- a/saas/app/models/account/storage_limited.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module Account::StorageLimited
- extend ActiveSupport::Concern
-
- STORAGE_LIMIT = 1.gigabyte
- NEAR_STORAGE_LIMIT_THRESHOLD = 500.megabytes
-
- def exceeding_storage_limit?
- bytes_used > STORAGE_LIMIT
- end
-
- def nearing_storage_limit?
- !exceeding_storage_limit? && bytes_used > STORAGE_LIMIT - NEAR_STORAGE_LIMIT_THRESHOLD
- end
-end
diff --git a/saas/app/views/cards/comments/saas/_new.html.erb b/saas/app/views/cards/comments/saas/_new.html.erb
deleted file mode 100644
index 74cb6dd43..000000000
--- a/saas/app/views/cards/comments/saas/_new.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<% if Current.account.exceeding_storage_limit? %>
- <%= render "cards/comments/saas/storage_limit_exceeded" %>
-<% else %>
- <%= render "cards/comments/new", card: card %>
-<% end %>
diff --git a/saas/app/views/cards/comments/saas/_storage_limit_exceeded.html.erb b/saas/app/views/cards/comments/saas/_storage_limit_exceeded.html.erb
deleted file mode 100644
index 82ab7f25e..000000000
--- a/saas/app/views/cards/comments/saas/_storage_limit_exceeded.html.erb
+++ /dev/null
@@ -1,12 +0,0 @@
-
diff --git a/saas/app/views/cards/container/footer/saas/_create.html.erb b/saas/app/views/cards/container/footer/saas/_create.html.erb
deleted file mode 100644
index e5544e576..000000000
--- a/saas/app/views/cards/container/footer/saas/_create.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<% if Current.account.exceeding_storage_limit? %>
- <%= render "cards/container/footer/saas/storage_limit_exceeded" %>
-<% else %>
- <%= render "cards/container/footer/create", card: card %>
-<% end %>
diff --git a/saas/app/views/cards/container/footer/saas/_storage_limit_exceeded.html.erb b/saas/app/views/cards/container/footer/saas/_storage_limit_exceeded.html.erb
deleted file mode 100644
index ca0dc9be0..000000000
--- a/saas/app/views/cards/container/footer/saas/_storage_limit_exceeded.html.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
This account has used all the included free storage (<%= number_to_human_size(Account::StorageLimited::STORAGE_LIMIT) %>).
-
- <%= link_to "Self-host Fizzy", "https://github.com/basecamp/fizzy", target: "_blank" %> for unlimited storage.
-
-
-
diff --git a/saas/app/views/cards/container/footer/saas/_storage_limit_notice.html.erb b/saas/app/views/cards/container/footer/saas/_storage_limit_notice.html.erb
deleted file mode 100644
index 41bb987f0..000000000
--- a/saas/app/views/cards/container/footer/saas/_storage_limit_notice.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<% if Current.account.nearing_storage_limit? %>
-
- This account has used
<%= number_to_human_size(Current.account.bytes_used) %> of
<%= number_to_human_size(Account::StorageLimited::STORAGE_LIMIT) %> storage.
-
<%= link_to "Self-host Fizzy", "https://github.com/basecamp/fizzy", class: "txt-current txt-underline", target: "_blank" %> for unlimited storage.
-
-<% end %>
diff --git a/saas/lib/fizzy/saas/engine.rb b/saas/lib/fizzy/saas/engine.rb
index 673be1147..dea321cfc 100644
--- a/saas/lib/fizzy/saas/engine.rb
+++ b/saas/lib/fizzy/saas/engine.rb
@@ -133,14 +133,10 @@ module Fizzy
end
config.to_prepare do
- ::Account.include Account::StorageLimited
::Identity.include Authorization::Identity, Identity::Devices
::Session.include Session::Devices
::Signup.prepend Signup
ApplicationController.include Authorization::Controller
- CardsController.include(Card::StorageLimited::Creation)
- Cards::CommentsController.include(Card::StorageLimited::Commenting)
- Cards::PublishesController.include(Card::StorageLimited::Publishing)
Notification.register_push_target(:native)
diff --git a/saas/test/controllers/card/storage_limited/commenting_test.rb b/saas/test/controllers/card/storage_limited/commenting_test.rb
deleted file mode 100644
index e32015130..000000000
--- a/saas/test/controllers/card/storage_limited/commenting_test.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require "test_helper"
-
-class Card::StorageLimited::CommentingTest < ActionDispatch::IntegrationTest
- test "cannot create comments when storage limit exceeded" do
- sign_in_as :david
-
- Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
-
- assert_no_difference -> { Comment.count } do
- post card_comments_path(cards(:logo), script_name: accounts(:"37s").slug),
- params: { comment: { body: "Blocked comment" } },
- as: :turbo_stream
- end
-
- assert_response :forbidden
- end
-
- test "can create comments when under storage limit" do
- sign_in_as :david
-
- assert_difference -> { Comment.count } do
- post card_comments_path(cards(:logo), script_name: accounts(:"37s").slug),
- params: { comment: { body: "Allowed comment" } },
- as: :turbo_stream
- end
-
- assert_response :success
- end
-end
diff --git a/saas/test/controllers/card/storage_limited/creation_test.rb b/saas/test/controllers/card/storage_limited/creation_test.rb
deleted file mode 100644
index ab04774fe..000000000
--- a/saas/test/controllers/card/storage_limited/creation_test.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require "test_helper"
-
-class Card::StorageLimited::CreationTest < ActionDispatch::IntegrationTest
- test "cannot create cards via JSON when storage limit exceeded" do
- sign_in_as :mike
-
- Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
-
- assert_no_difference -> { Card.count } do
- post board_cards_path(boards(:miltons_wish_list), script_name: accounts(:initech).slug),
- params: { card: { title: "Blocked card" } },
- as: :json
- end
-
- assert_response :forbidden
- end
-
- test "can create cards via HTML when storage limit exceeded since they become drafts" do
- sign_in_as :mike
-
- Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
- accounts(:initech).update_column(:cards_count, 100)
- boards(:miltons_wish_list).cards.drafted.where(creator: users(:mike)).destroy_all
-
- assert_difference -> { Card.count } do
- post board_cards_path(boards(:miltons_wish_list), script_name: accounts(:initech).slug)
- end
-
- assert_response :redirect
- assert Card.last.drafted?
- end
-
- test "can create cards via JSON when under storage limit" do
- sign_in_as :mike
-
- Account.any_instance.stubs(:bytes_used).returns(500.megabytes)
- accounts(:initech).update_column(:cards_count, 100)
-
- assert_difference -> { Card.count } do
- post board_cards_path(boards(:miltons_wish_list), script_name: accounts(:initech).slug),
- params: { card: { title: "Allowed card" } },
- as: :json
- end
-
- assert_response :created
- end
-end
diff --git a/saas/test/controllers/card/storage_limited/publishing_test.rb b/saas/test/controllers/card/storage_limited/publishing_test.rb
deleted file mode 100644
index 94e9b8e4f..000000000
--- a/saas/test/controllers/card/storage_limited/publishing_test.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require "test_helper"
-
-class Card::StorageLimited::PublishingTest < ActionDispatch::IntegrationTest
- test "cannot publish cards when storage limit exceeded" do
- sign_in_as :mike
-
- Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
-
- post card_publish_path(cards(:unfinished_thoughts), script_name: accounts(:initech).slug)
-
- assert_response :forbidden
- assert cards(:unfinished_thoughts).reload.drafted?
- end
-
- test "can publish cards when under storage limit" do
- sign_in_as :mike
-
- post card_publish_path(cards(:unfinished_thoughts), script_name: accounts(:initech).slug)
-
- assert_response :redirect
- assert cards(:unfinished_thoughts).reload.published?
- end
-end
diff --git a/saas/test/controllers/card/storage_limited_test.rb b/saas/test/controllers/card/storage_limited_test.rb
deleted file mode 100644
index 69790c363..000000000
--- a/saas/test/controllers/card/storage_limited_test.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require "test_helper"
-
-class Card::StorageLimitedTest < ActionDispatch::IntegrationTest
- test "draft card shows storage limit notice instead of create buttons when limit exceeded" do
- sign_in_as :mike
-
- Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
-
- get card_draft_path(cards(:unfinished_thoughts), script_name: accounts(:initech).slug)
-
- assert_response :success
- assert_select ".card-perma__notch" do
- assert_select "strong", text: /used all/
- assert_select "a[href='https://github.com/basecamp/fizzy']", text: "Self-host Fizzy"
- end
- assert_select ".card-perma__notch-new-card-buttons", count: 0
- end
-
- test "draft card shows create buttons when under storage limit" do
- sign_in_as :mike
-
- get card_draft_path(cards(:unfinished_thoughts), script_name: accounts(:initech).slug)
-
- assert_response :success
- assert_select ".card-perma__notch-new-card-buttons"
- end
-end
diff --git a/saas/test/controllers/comment/storage_limited_test.rb b/saas/test/controllers/comment/storage_limited_test.rb
deleted file mode 100644
index 4137971b1..000000000
--- a/saas/test/controllers/comment/storage_limited_test.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require "test_helper"
-
-class Comment::StorageLimitedTest < ActionDispatch::IntegrationTest
- test "published card shows storage limit notice instead of comment form when limit exceeded" do
- sign_in_as :david
-
- Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
-
- get card_path(cards(:logo), script_name: accounts(:"37s").slug)
-
- assert_response :success
- assert_select "strong", text: /used all/
- assert_select "a[href='https://github.com/basecamp/fizzy']", text: "Self-host Fizzy"
- assert_select "##{dom_id(cards(:logo), :new_comment)}", count: 0
- end
-
- test "published card shows comment form when under storage limit" do
- sign_in_as :david
-
- get card_path(cards(:logo), script_name: accounts(:"37s").slug)
-
- assert_response :success
- assert_select "##{dom_id(cards(:logo), :new_comment)}"
- end
-end
diff --git a/saas/test/models/account/storage_limited_test.rb b/saas/test/models/account/storage_limited_test.rb
deleted file mode 100644
index f587d9ef1..000000000
--- a/saas/test/models/account/storage_limited_test.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-require "test_helper"
-
-class Account::StorageLimitedTest < ActiveSupport::TestCase
- test "exceeding storage limit when bytes used exceeds 1 GB" do
- Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
-
- assert accounts(:initech).exceeding_storage_limit?
- end
-
- test "not exceeding storage limit when bytes used equals 1 GB" do
- Account.any_instance.stubs(:bytes_used).returns(1.gigabyte)
-
- assert_not accounts(:initech).exceeding_storage_limit?
- end
-
- test "not exceeding storage limit when under 1 GB" do
- Account.any_instance.stubs(:bytes_used).returns(500.megabytes)
-
- assert_not accounts(:initech).exceeding_storage_limit?
- end
-
- test "nearing storage limit when within 500 MB of the limit" do
- Account.any_instance.stubs(:bytes_used).returns(600.megabytes)
-
- assert accounts(:initech).nearing_storage_limit?
- end
-
- test "not nearing storage limit when well under the threshold" do
- Account.any_instance.stubs(:bytes_used).returns(400.megabytes)
-
- assert_not accounts(:initech).nearing_storage_limit?
- end
-
- test "not nearing storage limit when already exceeding it" do
- Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
-
- assert_not accounts(:initech).nearing_storage_limit?
- end
-end