Merge diffs from master

This commit is contained in:
Neil Lalonde 2020-11-30 16:42:54 -05:00
parent fef0a0c429
commit a502a47197
No known key found for this signature in database
GPG Key ID: FF871CA9037D0A91
10 changed files with 2 additions and 30 deletions

View File

@ -455,7 +455,6 @@ class TopicsController < ApplicationController
params.require(:duration) if based_on_last_post
topic = Topic.find_by(id: params[:topic_id])
guardian.ensure_can_see!(topic)
guardian.ensure_can_moderate!(topic)
options = {

View File

@ -47,8 +47,6 @@ class Category < ActiveRecord::Base
has_and_belongs_to_many :web_hooks
has_one :category_search_data, dependent: :delete
validates :user_id, presence: true
validates :name, if: Proc.new { |c| c.new_record? || c.will_save_change_to_name? || c.will_save_change_to_parent_category_id? },

View File

@ -52,7 +52,6 @@ class Post < ActiveRecord::Base
has_many :revisions, -> { order(:number) }, foreign_key: :post_id, class_name: 'PostRevision'
has_many :user_actions, foreign_key: :target_post_id
has_one :post_search_data, dependent: :delete
belongs_to :image_upload, class_name: "Upload"

View File

@ -45,8 +45,6 @@ class Tag < ActiveRecord::Base
belongs_to :target_tag, class_name: "Tag", optional: true
has_many :synonyms, class_name: "Tag", foreign_key: "target_tag_id", dependent: :destroy
has_one :tag_search_data, dependent: :delete
after_save :index_search
after_save :update_synonym_associations

View File

@ -240,7 +240,7 @@ class Topic < ActiveRecord::Base
has_one :user_warning
has_one :first_post, -> { where post_number: 1 }, class_name: 'Post'
has_one :topic_search_data, dependent: :delete
has_one :topic_search_data
has_one :topic_embed, dependent: :destroy
has_one :linked_topic, dependent: :destroy

View File

@ -47,7 +47,6 @@ class User < ActiveRecord::Base
has_one :anonymous_user_master, class_name: 'AnonymousUser', dependent: :destroy
has_one :anonymous_user_shadow, ->(record) { where(active: true) }, foreign_key: :master_user_id, class_name: 'AnonymousUser', dependent: :destroy
has_one :invited_user, dependent: :destroy
has_one :user_search_data, dependent: :delete
# delete all is faster but bypasses callbacks
has_many :bookmarks, dependent: :delete_all

View File

@ -447,14 +447,4 @@ class UploadCreator
@upload.secure = UploadSecurity.new(@upload, @opts).should_be_secure?
end
def add_metadata!
@upload.for_private_message = true if @opts[:for_private_message]
@upload.for_group_message = true if @opts[:for_group_message]
@upload.for_theme = true if @opts[:for_theme]
@upload.for_export = true if @opts[:for_export]
@upload.for_site_setting = true if @opts[:for_site_setting]
@upload.for_gravatar = true if @opts[:for_gravatar]
@upload.secure = UploadSecurity.new(@upload, @opts).should_be_secure?
end
end

View File

@ -4,8 +4,6 @@ module Discourse
VERSION_REGEXP ||= /\A\d+\.\d+\.\d+(\.beta\d+)?\z/
VERSION_COMPATIBILITY_FILENAME ||= ".discourse-compatibility"
VERSION_COMPATIBILITY_FILENAME = ".discourse-compatibility"
# work around reloader
unless defined? ::Discourse::VERSION
module VERSION #:nodoc:

View File

@ -125,6 +125,7 @@ describe Middleware::AnonymousCache do
expect(crawler.cached).to eq([200, { "X-Discourse-Cached" => "true", "HELLO" => "WORLD" }, ["hello world"]])
end
end
end
context 'background request rate limit' do
it 'will rate limit background requests' do

View File

@ -236,16 +236,6 @@ RSpec.describe ListController do
expect(response.status).to eq(404)
end
it 'should return the right response when user does not belong to group' do
Fabricate(:private_message_topic, allowed_groups: [group])
group.remove(user)
get "/topics/private-messages-group/#{user.username}/#{group.name}.json"
expect(response.status).to eq(404)
end
it 'should return the right response' do
topic = Fabricate(:private_message_topic, allowed_groups: [group])
get "/topics/private-messages-group/#{user.username}/#{group.name}.json"