From c7a78558eae4e3ce8b8706628fc544f233235f45 Mon Sep 17 00:00:00 2001 From: Darius Kazemi Date: Sat, 16 May 2020 13:01:41 -0700 Subject: [PATCH] Fixing merge & local pinned post leak --- app/controllers/accounts_controller.rb | 6 ++++- app/controllers/api/v1/statuses_controller.rb | 2 +- db/schema.rb | 24 ------------------- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 3424015ce..402555e10 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -26,7 +26,11 @@ class AccountsController < ApplicationController return end - @pinned_statuses = cache_collection(@account.pinned_statuses, Status) if show_pinned_statuses? + if current_user.nil? + @pinned_statuses = cache_collection(@account.pinned_statuses.without_local_only, Status) if show_pinned_statuses? + else + @pinned_statuses = cache_collection(@account.pinned_statuses, Status) if show_pinned_statuses? + end @statuses = filtered_status_page @statuses = cache_collection(@statuses, Status) @rss_url = rss_url diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 21ef3f210..4897f3e1f 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -46,7 +46,7 @@ class Api::V1::StatusesController < Api::BaseController application: doorkeeper_token.application, poll: status_params[:poll], idempotency: request.headers['Idempotency-Key'], - local_only: status_params[:local_only]), + local_only: status_params[:local_only], with_rate_limit: true) render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer diff --git a/db/schema.rb b/db/schema.rb index 28eafc383..8e214e706 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -752,30 +752,6 @@ ActiveRecord::Schema.define(version: 2020_05_10_110808) do t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true end - create_table "stream_entries", force: :cascade do |t| - t.bigint "activity_id" - t.string "activity_type" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "hidden", default: false, null: false - t.bigint "account_id" - t.index ["account_id", "activity_type", "id"], name: "index_stream_entries_on_account_id_and_activity_type_and_id" - t.index ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type" - end - - create_table "subscriptions", force: :cascade do |t| - t.string "callback_url", default: "", null: false - t.string "secret" - t.datetime "expires_at" - t.boolean "confirmed", default: false, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "last_successful_delivery_at" - t.string "domain" - t.bigint "account_id", null: false - t.index ["account_id", "callback_url"], name: "index_subscriptions_on_account_id_and_callback_url", unique: true - end - create_table "tags", force: :cascade do |t| t.string "name", default: "", null: false t.datetime "created_at", null: false