[deploy] Remove column and minor cleanup (#7642)

* Remove column and minor cleanup

* More cleanup

* Fix spec

* Remove category from select

* Wake up Travis

* No space for you
This commit is contained in:
Michael Kohl 2020-05-03 22:52:03 +07:00 committed by GitHub
parent 48c47b5c47
commit fcd0639d2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 14 deletions

View file

@ -333,7 +333,7 @@ class StoriesController < ApplicationController
end
def assign_classified_listings
@classified_listings = ClassifiedListing.where(published: true).select(:title, :category, :classified_listing_category_id, :slug, :bumped_at)
@classified_listings = ClassifiedListing.where(published: true).select(:title, :classified_listing_category_id, :slug, :bumped_at)
end
def redirect_to_lowercase_username

View file

@ -1,6 +1,4 @@
class ClassifiedListing < ApplicationRecord
self.ignored_columns = ["category"]
include Searchable
SEARCH_SERIALIZER = Search::ClassifiedListingSerializer

View file

@ -32,15 +32,15 @@
data-allcategories="<%= categories_for_display.to_json %>"
<% if @displayed_classified_listing %>
data-displayedlisting="<%= @displayed_listing_json %> "
<% end %>
>
<% end %>>
<div class="classified-filters">
<div class="classified-filters-categories">
<a href="/listings" class="<%= "selected" if params[:category].blank? %> data-no-instant="true">all</a>
<a href="<%= classified_listings_path %>" class="<%= "selected" if params[:category].blank? %> data-no-instant="true">all</a>
<% categories_for_display.each do |cat| %>
<a href="/listings/<%= cat[:slug] %>" class="<%= "selected" if params[:category] == cat[:slug] %> data-no-instant="true"><%= cat[:name] %></a>
<a href="<%= classified_listing_category_path(category: cat[:slug]) %>" class="<%= "selected" if params[:category] == cat[:slug] %> data-no-instant="true"><%= cat[:name] %></a>
<% end %>
<a href='/listings/new' class='classified-create-link'>Create a Listing</a>
<a href="<%= new_classified_listing_path %>" class='classified-create-link'>Create a Listing</a>
<% if @displayed_classified_listing %>
<div class="classified-listings-modal-background" role='presentation'></div>
<% end %>

View file

@ -238,7 +238,7 @@ Rails.application.routes.draw do
get "/search/reactions" => "search#reactions"
get "/chat_channel_memberships/find_by_chat_channel_id" => "chat_channel_memberships#find_by_chat_channel_id"
get "/listings/dashboard" => "classified_listings#dashboard"
get "/listings/:category" => "classified_listings#index"
get "/listings/:category" => "classified_listings#index", :as => :classified_listing_category
get "/listings/:category/:slug" => "classified_listings#index", :as => :classified_listing_slug
get "/listings/:category/:slug/:view" => "classified_listings#index",
:constraints => { view: /moderate/ }

View file

@ -0,0 +1,5 @@
class RemoveCategoryFromClassifiedListing < ActiveRecord::Migration[5.2]
def change
safety_assured { remove_column :classified_listings, :category }
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_04_26_124118) do
ActiveRecord::Schema.define(version: 2020_05_01_032629) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -308,7 +308,6 @@ ActiveRecord::Schema.define(version: 2020_04_26_124118) do
t.string "slug"
t.string "status", default: "active"
t.datetime "updated_at", null: false
t.index ["slug"], name: "index_chat_channels_on_slug", unique: true
end
create_table "classified_listing_categories", force: :cascade do |t|
@ -326,7 +325,6 @@ ActiveRecord::Schema.define(version: 2020_04_26_124118) do
t.text "body_markdown"
t.datetime "bumped_at"
t.string "cached_tag_list"
t.string "category"
t.bigint "classified_listing_category_id"
t.boolean "contact_via_connect", default: false
t.datetime "created_at", null: false

View file

@ -379,7 +379,7 @@ CATEGORIES = [
slug: "cfp",
cost: 1,
name: "Conference CFP",
rules: "Currently open for proposals,with link to form."
rules: "Currently open for proposals, with link to form."
},
{
slug: "education",

View file

@ -117,7 +117,7 @@ RSpec.describe "Api::V0::ClassifiedListings", type: :request do
it "does not return unpublished listings" do
category = "cfp"
listing = user1.classified_listings.where(category: category)
listing = user1.classified_listings.in_category(category).last
listing.update(published: false)
get api_classified_listings_category_path(category)