Skip to content

Normalize published/inactive#850

Draft
maebeale wants to merge 4 commits intomainfrom
normalize-featureable-and-publishable
Draft

Normalize published/inactive#850
maebeale wants to merge 4 commits intomainfrom
normalize-featureable-and-publishable

Conversation

@maebeale
Copy link
Collaborator

@maebeale maebeale commented Feb 5, 2026

  • This work Closes [link an issue]

What is the goal of this PR and why is this important?

  • Normalize usage of published/unpublished/hidden/inactive/active/show
  • Update policies

How did you approach the change?

Anything else to add?

  • Fix tag_names searching
  • Moved common scopes into Publishable and Featureable

@most_printed_resources = decorate_with_counts(most_printed_for_model(Resource, time_scope), :print_count)
# @most_printed_community_news = decorate_with_counts(most_printed_for_model(CommunityNews, time_scope), :print_count)
# @most_printed_stories = decorate_with_counts(most_printed_for_model(Story, time_scope), :print_count)
@most_printed_community_news = decorate_with_counts(most_printed_for_model(CommunityNews, time_scope), :print_count)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sidequest: these were missing from the view


total_results = grouped_results.values.sum { |r| r.respond_to?(:total_entries) ? r.total_entries : r.size }

# total_results = grouped_results.values.sum { |r| r.respond_to?(:total_entries) ? r.total_entries : r.size }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sidequest: turning ahoy totals off for now bc was hitting an error

@maebeale maebeale changed the title WIP Normalize published/inactive Normalize published/inactive Feb 6, 2026
# Read more about authorization context: https://actionpolicy.evilmartians.io/#/authorization_context
#
authorize :user, optional: true, allow_nil: true
pre_check :verify_authenticated!
Copy link
Collaborator Author

@maebeale maebeale Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was conflicting w rules like def index?, and making it impossible to open some endpoints to public/guest access

add_column table, :published, :boolean, null: false, default: false
add_index table, :published

say_with_time "Backfilling #{table}.published" do
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert inactive column data input published data

workshop_variations
workshops

banners
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two don't have an inactive column

@@ -0,0 +1,74 @@
class AddPublishedToTables < ActiveRecord::Migration[8.1]
TABLES = %i[
events
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tables have an inactive column
this migration adds published but leaves the inactive column in place.

we'll remove this column later when we remove all legacy tables and columns.

@@ -0,0 +1,12 @@
class RemoveInactiveFromTaggings < ActiveRecord::Migration[8.1]
def change
# Remove inactive column from sectorable_items and categorizable_items bc they should either exist or not
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was a boolean on [taggable]_items but none of the code was using it to filter taggings -- all were showing in the UI. looks like all of the taggings should be live, so, removing these columns entirely since they're not needed. going forward, an item will either have a tagging or not -- no inactive/published state.

factory :category_type do
sequence(:name) { |n| "Category Type Name #{n}" }
published { true }
published { false }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting all factories to published=false, since that's the db default

class Category < ApplicationRecord
include NameFilterable
include Positioning
include NameFilterable, Positioning, Publishable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
include NameFilterable, Positioning, Publishable
include NameFilterable, Publishable

Side note: I don't think you have to include Positioning. Should just need to call the positioned method (which we already have below)

Copy link
Collaborator

@jmilljr24 jmilljr24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job with the Concerns!

Just one comment unrelated to the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants