From 404a1292d4e97ff1bdb204cdc4bb57ee17bee97d Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 30 Sep 2026 12:50:41 +0000 Subject: [PATCH] [Admin] Experiences and plans in Avo - Experience resource: fields, 16-language tabs, places with a position - Plan resource: curated and travellers' public plans only, stops by day - PlanPolicy: private plans never found, travellers' plans read-only - AdminAssociationGate: attaching and detaching ask the parent's policy - Shared translation tabs for places, experiences and plans - Brain: slice 4 build notes, the plans answer as a source --- app/avo/filters/plan_ownership.rb | 15 ++++ app/avo/resources/experience.rb | 28 +++++++ app/avo/resources/location.rb | 19 +---- app/avo/resources/plan.rb | 42 ++++++++++ app/avo/translated_fields.rb | 16 ++++ app/controllers/avo/experiences_controller.rb | 3 + app/controllers/avo/plans_controller.rb | 3 + .../concerns/admin_association_gate.rb | 18 ++++ app/policies/plan_policy.rb | 17 ++++ config/initializers/avo_associations.rb | 4 + config/locales/bs.yml | 25 +++++- config/locales/en.yml | 25 +++++- .../2026-09-30--usput--plans-in-avo.md | 11 +++ .../admin_experiences_plans_test.rb | 82 +++++++++++++++++++ test/policies/plan_policy_test.rb | 37 +++++++++ wiki/initiatives/avo-admin-and-roles.md | 25 +++++- wiki/state.md | 2 +- 17 files changed, 346 insertions(+), 26 deletions(-) create mode 100644 app/avo/filters/plan_ownership.rb create mode 100644 app/avo/resources/experience.rb create mode 100644 app/avo/resources/plan.rb create mode 100644 app/avo/translated_fields.rb create mode 100644 app/controllers/avo/experiences_controller.rb create mode 100644 app/controllers/avo/plans_controller.rb create mode 100644 app/controllers/concerns/admin_association_gate.rb create mode 100644 app/policies/plan_policy.rb create mode 100644 config/initializers/avo_associations.rb create mode 100644 sources/conversations/2026-09-30--usput--plans-in-avo.md create mode 100644 test/integration/admin_experiences_plans_test.rb create mode 100644 test/policies/plan_policy_test.rb diff --git a/app/avo/filters/plan_ownership.rb b/app/avo/filters/plan_ownership.rb new file mode 100644 index 00000000..91bfcb94 --- /dev/null +++ b/app/avo/filters/plan_ownership.rb @@ -0,0 +1,15 @@ +class Avo::Filters::PlanOwnership < Avo::Filters::SelectFilter + self.name = -> { I18n.t("admin.plans.ownership") } + + def apply(_request, query, value) + case value + when "curated" then query.where(user_id: nil) + when "travellers" then query.where.not(user_id: nil) + else query + end + end + + def options + %w[curated travellers].index_with { |kind| I18n.t("admin.plans.ownerships.#{kind}") } + end +end diff --git a/app/avo/resources/experience.rb b/app/avo/resources/experience.rb new file mode 100644 index 00000000..014235c1 --- /dev/null +++ b/app/avo/resources/experience.rb @@ -0,0 +1,28 @@ +class Avo::Resources::Experience < Avo::BaseResource + include Avo::TranslatedFields + + self.icon = "tabler/outline/route" + self.title = :title + self.includes = [ :translations ] + self.find_record_method = -> { id.is_a?(Array) ? query.where(uuid: id) : query.find_by!(uuid: id) } + self.search = { + query: -> { query.where("experiences.title ILIKE :q", q: "%#{params[:q]}%") } + } + + def fields + field :title, as: :text, required: true, sortable: true, link_to_record: true + field :experience_category_id, as: :select, name: I18n.t("admin.experiences.category"), include_blank: true, + options: -> { ExperienceCategory.order(:name).map { |category| [ category.name, category.id ] }.to_h } + field :estimated_duration, as: :number, name: I18n.t("admin.experiences.duration"), hide_on: :index + field :cover_photo, as: :file, is_image: true, hide_on: :index + field :contact_name, as: :text, hide_on: :index + field :contact_phone, as: :text, hide_on: :index + field :contact_email, as: :text, hide_on: :index + field :contact_website, as: :text, hide_on: :index + field :ai_generated, as: :boolean, readonly: true, hide_on: :forms + field :average_rating, as: :number, readonly: true, hide_on: :forms + translation_tabs :title, :description, long: %i[description] + field :locations, as: :has_many, through: :experience_locations, name: I18n.t("admin.experiences.places"), + attach_fields: -> { field :position, as: :number, default: 0 } + end +end diff --git a/app/avo/resources/location.rb b/app/avo/resources/location.rb index 083a08f7..c268c85c 100644 --- a/app/avo/resources/location.rb +++ b/app/avo/resources/location.rb @@ -1,4 +1,6 @@ class Avo::Resources::Location < Avo::BaseResource + include Avo::TranslatedFields + self.icon = "tabler/outline/map-pin" self.title = :name self.includes = [ :translations ] @@ -9,12 +11,10 @@ class Avo::Resources::Location < Avo::BaseResource query: -> { query.where("locations.name ILIKE :q OR locations.city ILIKE :q", q: "%#{params[:q]}%") } } - TRANSLATED = %i[name description historical_context].freeze - def fields main_panel field :photos, as: :files, is_image: true, hide_on: :index, name: I18n.t("admin.locations.photos") - translations_tabs + translation_tabs :name, :description, :historical_context, long: %i[description historical_context] end def filters @@ -47,17 +47,4 @@ def main_panel field :ai_generated, as: :boolean, readonly: true, hide_on: :forms field :average_rating, as: :number, readonly: true, hide_on: :forms end - - def translations_tabs - tabs do - Translation::SUPPORTED_LOCALES.each do |locale| - tab title: locale.upcase do - TRANSLATED.each do |attribute| - field :"#{attribute}_#{locale}", as: (attribute == :name ? :text : :textarea), - name: "#{I18n.t("admin.locations.fields.#{attribute}")} (#{locale})", hide_on: :index - end - end - end - end - end end diff --git a/app/avo/resources/plan.rb b/app/avo/resources/plan.rb new file mode 100644 index 00000000..be732699 --- /dev/null +++ b/app/avo/resources/plan.rb @@ -0,0 +1,42 @@ +class Avo::Resources::Plan < Avo::BaseResource + include Avo::TranslatedFields + + self.icon = "tabler/outline/map" + self.title = :title + self.includes = [ :translations, :user ] + # Curated plans and travellers' public plans only; a private plan is not + # found even by its link (PlanPolicy.visible). + self.index_query = -> { PlanPolicy.visible(query) } + self.find_record_method = -> { + scope = PlanPolicy.visible(query) + id.is_a?(Array) ? scope.where(uuid: id) : scope.find_by!(uuid: id) + } + self.search = { + query: -> { PlanPolicy.visible(query).where("plans.title ILIKE :q OR plans.city_name ILIKE :q", q: "%#{params[:q]}%") } + } + + def fields + field :title, as: :text, required: true, sortable: true, link_to_record: true + field :city_name, as: :text, name: I18n.t("admin.plans.city"), sortable: true + field :visibility, as: :select, enum: ::Plan.visibilities, hide_on: :index + field :owner, as: :text, name: I18n.t("admin.plans.owner"), readonly: true, hide_on: :forms, + format_using: -> { record.user&.username || I18n.t("admin.plans.curated") } + field :ai_generated, as: :boolean, readonly: true, hide_on: :forms + translation_tabs :title, :notes, long: %i[notes] + field :experiences, as: :has_many, through: :plan_experiences, name: I18n.t("admin.plans.experiences"), + attach_fields: -> { + field :day_number, as: :number, default: 1, name: I18n.t("admin.plans.day") + field :position, as: :number, default: 0 + } + field :location_items, as: :has_many, through: :plan_locations, name: I18n.t("admin.plans.places"), + use_resource: Avo::Resources::Location, + attach_fields: -> { + field :day_number, as: :number, default: 1, name: I18n.t("admin.plans.day") + field :position, as: :number, default: 0 + } + end + + def filters + filter Avo::Filters::PlanOwnership + end +end diff --git a/app/avo/translated_fields.rb b/app/avo/translated_fields.rb new file mode 100644 index 00000000..9f7d93a8 --- /dev/null +++ b/app/avo/translated_fields.rb @@ -0,0 +1,16 @@ +# One tab per supported language, with the resource's translated attributes, +# each read and written exactly in that language (Translatable accessors). +module Avo::TranslatedFields + def translation_tabs(*attributes, long: []) + tabs do + Translation::SUPPORTED_LOCALES.each do |locale| + tab title: locale.upcase do + attributes.each do |attribute| + field :"#{attribute}_#{locale}", as: (long.include?(attribute) ? :textarea : :text), + name: "#{I18n.t("admin.fields.#{attribute}")} (#{locale})", hide_on: :index + end + end + end + end + end +end diff --git a/app/controllers/avo/experiences_controller.rb b/app/controllers/avo/experiences_controller.rb new file mode 100644 index 00000000..e8898c9e --- /dev/null +++ b/app/controllers/avo/experiences_controller.rb @@ -0,0 +1,3 @@ +class Avo::ExperiencesController < Avo::ResourcesController + include AdminResource +end diff --git a/app/controllers/avo/plans_controller.rb b/app/controllers/avo/plans_controller.rb new file mode 100644 index 00000000..f6e7c198 --- /dev/null +++ b/app/controllers/avo/plans_controller.rb @@ -0,0 +1,3 @@ +class Avo::PlansController < Avo::ResourcesController + include AdminResource +end diff --git a/app/controllers/concerns/admin_association_gate.rb b/app/controllers/concerns/admin_association_gate.rb new file mode 100644 index 00000000..961915d8 --- /dev/null +++ b/app/controllers/concerns/admin_association_gate.rb @@ -0,0 +1,18 @@ +# Avo attaches and detaches related records (a plan's experiences, an +# experience's places) through its own associations controller. Linking or +# unlinking counts as editing the parent, so the parent's policy decides. +module AdminAssociationGate + extend ActiveSupport::Concern + + included do + before_action :enforce_parent_policy + end + + private + + def enforce_parent_policy + policy = AdminPolicy.for(@resource.model_class).new(_current_user, @record) + allowed = action_name.in?(%w[index show]) ? policy.show? : policy.update? + raise Avo::NotAuthorizedError unless allowed + end +end diff --git a/app/policies/plan_policy.rb b/app/policies/plan_policy.rb new file mode 100644 index 00000000..5e25eb9e --- /dev/null +++ b/app/policies/plan_policy.rb @@ -0,0 +1,17 @@ +# Curated plans (no traveller owns them) are the admin's to create and edit. +# Travellers' public plans can be looked at, so a curator can spot a problem, +# but never changed there; travellers' private plans never reach the admin. +class PlanPolicy < AdminPolicy + def self.visible(query) + query.where(user_id: nil).or(query.visibility_public_plan) + end + + def show? = curator? && visible_record? + def update? = curator? && curated? + def destroy? = admin? && curated? + + private + + def curated? = record.nil? || record.user_id.nil? + def visible_record? = record.nil? || record.user_id.nil? || record.visibility_public_plan? +end diff --git a/config/initializers/avo_associations.rb b/config/initializers/avo_associations.rb new file mode 100644 index 00000000..b390f633 --- /dev/null +++ b/config/initializers/avo_associations.rb @@ -0,0 +1,4 @@ +# The policy gate on Avo's own associations controller (see AdminAssociationGate). +Rails.application.config.to_prepare do + Avo::AssociationsController.include(AdminAssociationGate) unless Avo::AssociationsController < AdminAssociationGate +end diff --git a/config/locales/bs.yml b/config/locales/bs.yml index fb3a455f..d9481856 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -608,6 +608,12 @@ bs: published: Uspomena podijeljena — curator će je pregledati prije nego postane javna unpublished: Uspomena je ponovo privatna admin: + fields: + name: Naziv + title: Naslov + description: Opis + historical_context: Historijski kontekst + notes: Bilješke welcome: title: Dobrodošli greeting: Zdravo, %{name} @@ -642,10 +648,6 @@ bs: photos: Fotografije photo_count: Fotografije coordinates_help: Geografska širina i dužina. Mjesto u području sumnjivom na mine ne može se sačuvati. - fields: - name: Naziv - description: Opis - historical_context: Historijski kontekst city: Grad status: Status statuses: @@ -664,6 +666,21 @@ bs: restored: one: Jedno mjesto je vraćeno. other: "Vraćeno mjesta: %{count}." + experiences: + category: Kategorija + duration: Trajanje (minute) + places: Mjesta + plans: + city: Grad + owner: Vlasnik + curated: Uredio Usput + experiences: Iskustva + places: Mjesta + day: Dan + ownership: Autor + ownerships: + curated: Usput + travellers: Putnici (javni) auth: register_title: Registracija - Usput register_heading: Kreiraj nalog diff --git a/config/locales/en.yml b/config/locales/en.yml index 4c7d3f90..d0eef2f4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -804,6 +804,12 @@ en: updated: Experience was successfully updated deleted: Experience was successfully deleted admin: + fields: + name: Name + title: Title + description: Description + historical_context: Historical context + notes: Notes welcome: title: Welcome greeting: Hello, %{name} @@ -838,10 +844,6 @@ en: photos: Photos photo_count: Photos coordinates_help: Latitude and longitude. A place inside a mine-suspected area cannot be saved. - fields: - name: Name - description: Description - historical_context: Historical context city: City status: Status statuses: @@ -860,6 +862,21 @@ en: restored: one: One place restored. other: "%{count} places restored." + experiences: + category: Category + duration: Duration (minutes) + places: Places + plans: + city: City + owner: Owner + curated: Curated by usput + experiences: Experiences + places: Places + day: Day + ownership: Made by + ownerships: + curated: Usput + travellers: Travellers (public) auth: register_title: Register - Usput register_heading: Create account diff --git a/sources/conversations/2026-09-30--usput--plans-in-avo.md b/sources/conversations/2026-09-30--usput--plans-in-avo.md new file mode 100644 index 00000000..7d401504 --- /dev/null +++ b/sources/conversations/2026-09-30--usput--plans-in-avo.md @@ -0,0 +1,11 @@ +--- +title: Which plans the admin shows, from the operator +date: 2026-09-30 +via: conversation with the agent +--- +# Plans in Avo, 2026-09-30 + +Before building the plans page in the admin, the agent asked which plans it +should list. The options were curated plans only (the ones no traveller owns), +curated plans plus travellers' public plans read-only, or every plan including +private ones. Answer: "Curated + travellers' public". diff --git a/test/integration/admin_experiences_plans_test.rb b/test/integration/admin_experiences_plans_test.rb new file mode 100644 index 00000000..7012411d --- /dev/null +++ b/test/integration/admin_experiences_plans_test.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +require "test_helper" + +class AdminExperiencesPlansTest < ActionDispatch::IntegrationTest + setup do + @curator = person(:curator) + @traveller = User.create!(username: "aep_traveller", email: "aep_traveller@example.com", password: "password123") + @place = Location.create!(name: "Stari most", city: "Mostar", lat: 43.3372, lng: 17.8150) + @experience = Experience.create!(title: "Mostar walk") + @curated = Plan.create!(title: "Curated weekend", city_name: "Mostar") + @shared = Plan.create!(title: "Shared trip", city_name: "Mostar", user: @traveller, visibility: :public_plan) + @private = Plan.create!(title: "Secret trip", city_name: "Mostar", user: @traveller) + sign_in @curator + end + + test "a curator edits an experience and its translations" do + patch "/admin/resources/experiences/#{@experience.to_param}", params: { experience: { title: "Mostar old town walk", title_de: "Altstadtspaziergang" } } + + @experience.reload + assert_equal "Mostar old town walk", @experience.title + assert_equal "Altstadtspaziergang", @experience.title_de + end + + test "a curator adds a place to an experience at a position" do + post "/admin/resources/experiences/#{@experience.to_param}/locations", + params: { fields: { related_id: @place.to_param, position: 2 } } + + assert_equal [ [ @place.id, 2 ] ], @experience.experience_locations.pluck(:location_id, :position) + end + + test "the plans list holds curated and public plans, never private ones" do + get "/admin/resources/plans" + + assert_response :success + assert_includes response.body, "Curated weekend" + assert_includes response.body, "Shared trip" + assert_not_includes response.body, "Secret trip" + end + + test "a private plan is not found even by its link" do + get "/admin/resources/plans/#{@private.to_param}" + + assert_response :not_found + end + + test "a curator edits a curated plan but not a traveller's" do + patch "/admin/resources/plans/#{@curated.to_param}", params: { plan: { title: "Curated long weekend" } } + assert_equal "Curated long weekend", @curated.reload.title + + patch "/admin/resources/plans/#{@shared.to_param}", params: { plan: { title: "Hijacked" } } + assert_equal "Shared trip", @shared.reload.title + end + + test "a curator adds an experience to a curated plan on a given day" do + post "/admin/resources/plans/#{@curated.to_param}/experiences", + params: { fields: { related_id: @experience.to_param, day_number: 2, position: 1 } } + + assert_equal [ [ @experience.id, 2, 1 ] ], @curated.plan_experiences.pluck(:experience_id, :day_number, :position) + end + + test "nothing can be attached to a traveller's plan" do + post "/admin/resources/plans/#{@shared.to_param}/experiences", + params: { fields: { related_id: @experience.to_param, day_number: 1, position: 1 } } + + assert_empty @shared.plan_experiences + end + + test "a curator cannot delete a plan or an experience" do + delete "/admin/resources/plans/#{@curated.to_param}" + delete "/admin/resources/experiences/#{@experience.to_param}" + + assert Plan.exists?(@curated.id) + assert Experience.exists?(@experience.id) + end + + private + + def person(role) + User.create!(username: "aep_#{role}", email: "aep_#{role}@example.com", password: "password123", user_type: role).tap(&:confirm) + end +end diff --git a/test/policies/plan_policy_test.rb b/test/policies/plan_policy_test.rb new file mode 100644 index 00000000..233ca91f --- /dev/null +++ b/test/policies/plan_policy_test.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require "test_helper" + +class PlanPolicyTest < ActiveSupport::TestCase + setup do + @curator = User.create!(username: "pp_curator", email: "pp_curator@example.com", password: "password123", user_type: :curator) + @admin = User.create!(username: "pp_admin", email: "pp_admin@example.com", password: "password123", user_type: :admin) + @traveller = User.create!(username: "pp_traveller", email: "pp_traveller@example.com", password: "password123") + @curated = Plan.create!(title: "Curated", city_name: "Mostar") + @shared = Plan.create!(title: "Shared", city_name: "Mostar", user: @traveller, visibility: :public_plan) + @private = Plan.create!(title: "Private", city_name: "Mostar", user: @traveller) + end + + test "curators edit curated plans; only admins delete them" do + assert PlanPolicy.new(@curator, @curated).update? + assert_not PlanPolicy.new(@curator, @curated).destroy? + assert PlanPolicy.new(@admin, @curated).destroy? + end + + test "a traveller's public plan can be looked at but never changed" do + assert PlanPolicy.new(@curator, @shared).show? + assert_not PlanPolicy.new(@curator, @shared).update? + assert_not PlanPolicy.new(@admin, @shared).destroy? + end + + test "a traveller's private plan is out of reach" do + assert_not PlanPolicy.new(@admin, @private).show? + assert_not_includes PlanPolicy.visible(Plan.all), @private + assert_includes PlanPolicy.visible(Plan.all), @shared + assert_includes PlanPolicy.visible(Plan.all), @curated + end + + test "a traveller never gets in" do + assert_not PlanPolicy.new(@traveller, @curated).show? + end +end diff --git a/wiki/initiatives/avo-admin-and-roles.md b/wiki/initiatives/avo-admin-and-roles.md index c1686d2f..abf34485 100644 --- a/wiki/initiatives/avo-admin-and-roles.md +++ b/wiki/initiatives/avo-admin-and-roles.md @@ -13,6 +13,7 @@ depends_on: - decisions/archive-places-not-delete.md sources: - sources/conversations/2026-09-30--usput--place-translations-in-avo.md +- sources/conversations/2026-09-30--usput--plans-in-avo.md - sources/conversations/2026-09-30--usput--platform-direction.md - config/routes.rb - app/controllers/curator/base_controller.rb @@ -114,7 +115,7 @@ Slices, in order on the rebuild branch, each with its tests: 1. **Done 2026-09-30.** Install Avo, mount it behind the role gate. Request tests: guest, `basic`, blocked user refused; curator and admin admitted. 2. **Done 2026-09-30.** The policy layer and the `User` resource (admin only), with role change and block actions. Policy unit tests per role; a request test that a curator cannot open users. 3. **Done 2026-09-30.** `Location` with filters, the archive and restore actions and photo uploads. Tests that the mine check blocks a bad coordinate through Avo and that a curator cannot delete. -4. `Experience` and `Plan`, including a plan's stops by day. Policy and request tests. +4. **Done 2026-09-30.** `Experience` and `Plan`, including a plan's stops by day. Policy and request tests. 5. `Moment` queue with approve and reject. Tests that an approved public moment becomes visible and a rejected one does not. 6. `Review` queue with clear and remove, once the flag exists ([Jev review flagging](jev-review-flagging.md)). Tests for both actions and for the rating recount. 7. `AdminEvent` written by every action and role change, shown on each record. Model and action tests. @@ -214,3 +215,25 @@ Slice 3 landed on 2026-09-30. - **The mine check shows on the form**: a coordinate inside a suspected area comes back as the form with the error, and nothing is saved. +Slice 4 landed on 2026-09-30. + +- **Experiences in Avo**: title, category, duration, cover photo and contact + fields, the title and description in all 16 languages, and the places an + experience visits, attached with a position. The per-language tabs are one + helper (`Avo::TranslatedFields`) shared with places. +- **Plans in Avo show curated plans and travellers' public plans**, as the + operator chose + ([answer](../../sources/conversations/2026-09-30--usput--plans-in-avo.md)). + `PlanPolicy.visible` scopes the list, the search and the record lookup, so a + private plan is not found even by its link. Curators create and edit curated + plans; a traveller's public plan is read-only; only admins delete, and only + curated plans. A filter splits curated from travellers' plans. +- **A plan's stops by day**: experiences and places are attached to a plan + with a day number and a position, the same join rows the public planner + writes. +- **Attaching and detaching are gated.** Avo links related records through its + own associations controller, which the per-resource gate did not reach. + `AdminAssociationGate`, included into that controller at boot, asks the + parent's policy: seeing the list needs `show?`, linking or unlinking needs + `update?`, so nothing can be attached to a traveller's plan. + diff --git a/wiki/state.md b/wiki/state.md index 799f8320..0df2a275 100644 --- a/wiki/state.md +++ b/wiki/state.md @@ -64,7 +64,7 @@ Where Usput.ba has been, what is true in the code today, what the older planning - **Stack.** Rails 8.1 on PostgreSQL (PostGIS only offline, to build the Mine Checker's static artifacts, per `docs/mine_checker/README.md`), Hotwire, Tailwind, Solid Queue; two databases (`db/schema.rb`, `sources/planning/decisions/2026-02-03-remove-platform-database.md`). - **Public product.** Home, explore (the Browse-backed search with filters for type, season, budget, duration, rating, city, origin, audio and accessibility), Explore Bosnia (a deck of places, nearest first), location, experience and plan pages, the plan wizard, walking a plan with check-ins, moments with likes, a travel profile that works without an account, reviews, `/mine-check` and the minesweeper game (`config/routes.rb`). - **Accounts.** Devise with sign-in by email, confirmation within three days, reset by email through Postmark, an account page, and one token that ends every session on a password change, a block or a button; #171's session rows are gone ([decision](decisions/accounts-through-devise.md)). A database holding accounts without an email cannot migrate, by design: the rebuild starts empty. -- **Admin.** Avo 4 Community at `/admin`, open only to curators and admins, checked in the route and again inside Avo; users page for admins, with role changes and blocks, and places with all 16 languages editable ([Avo admin and roles](initiatives/avo-admin-and-roles.md)). The old curator dashboard still runs beside it until each Avo slice replaces a part. +- **Admin.** Avo 4 Community at `/admin`, open only to curators and admins, checked in the route and again inside Avo; users page for admins, with role changes and blocks, places, experiences and plans with all 16 languages editable, plans limited to curated ones and travellers' public ones ([Avo admin and roles](initiatives/avo-admin-and-roles.md)). The old curator dashboard still runs beside it until each Avo slice replaces a part. - **Curator dashboard.** Curators browse and propose changes to locations, experiences, plans and audio tours; proposals are `ContentChange` records that admins approve or reject under `curator/admin/content_changes`. Admins also approve photo suggestions, curator applications and users. Moments have a pending, approved, rejected queue (`Moment` enum `moderation_status`). Direct edit, delete and create buttons are hidden unless the global `curator_edit_delete` flag is on. Places are archived and restored rather than deleted. - **Reviews are unmoderated.** `Review` has no status column; any visitor can post (the controller has no login requirement and still permits `author_name`), and every review counts toward `average_rating` (`app/models/review.rb`, `app/controllers/reviews_controller.rb`). - **Platform CLI.** `bin/platform` offers `status`, `version`, `query` and `exec` for DSL queries; there is no `chat` command (`lib/platform/cli.rb`). Executors cover schema, table queries, content, curators, external data, infrastructure and quality. The MCP server exists (`lib/platform/mcp_server.rb`) and refuses to run in production.