Merge branch 'develop' of https://code.gab.com/gab/social/gab-social into develop

This commit is contained in:
mgabdev 2020-12-29 13:09:08 -05:00
commit 6821909a3f
4 changed files with 28 additions and 7 deletions

View File

@ -10,6 +10,7 @@ class Auth::SessionsController < Devise::SessionsController
prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create]
before_action :set_instance_presenter, only: [:new]
before_action :set_body_classes
before_action :use_master
def new
Devise.omniauth_configs.each do |provider, config|
@ -35,6 +36,10 @@ class Auth::SessionsController < Devise::SessionsController
protected
def use_master
User.connection.stick_to_master!
end
def find_user
if session[:otp_user_id]
User.find(session[:otp_user_id])

View File

@ -291,7 +291,11 @@ class Status < ApplicationRecord
def as_home_timeline(account)
query = where('created_at > ?', 10.days.ago)
query.where(visibility: [:public, :unlisted, :private])
query.where(visibility: [:public, :unlisted]).or(
where(visibility: [:private]).where('group is null')
).or(
where(visibility: [:private]).where(group: account.groups)
)
query.where(account: [account] + account.following).without_replies
end

View File

@ -151,7 +151,7 @@ class PostStatusService < BaseService
raise GabSocial::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 4 || @options[:poll].present?
# @account.media_attachments.connection.stick_to_master!
@account.media_attachments.connection.stick_to_master!
@media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i))
hasVideoOrGif = @media.find(&:video?) || @media.find(&:gifv?)

View File

@ -7,11 +7,23 @@ default: &default
development:
<<: *default
database: <%= ENV['DB_NAME'] || 'gabsocial_development' %>
username: <%= ENV['DB_USER'] %>
password: <%= ENV['DB_PASS'] %>
host: <%= ENV['DB_HOST'] %>
port: <%= ENV['DB_PORT'] %>
adapter: postgresql_makara
prepared_statements: false
makara:
id: postgres
sticky: true
connections:
- role: master
blacklist_duration: 0
url: postgresql://<%= ENV['DB_USER']%>:<%= ENV['DB_PASS'] %>@<%= ENV['DB_HOST'] %>:<%= ENV['DB_PORT'] %>/<%= ENV['DB_NAME'] || 'gabsocial_development' %>
- role: slave
url: postgresql://<%= ENV['DB_USER']%>:<%= ENV['DB_PASS'] %>@<%= ENV['DB_HOST'] %>:<%= ENV['DB_PORT'] %>/<%= ENV['DB_NAME'] || 'gabsocial_development' %>
# database: <%= ENV['DB_NAME'] || 'gabsocial_development' %>
# username: <%= ENV['DB_USER'] %>
# password: <%= ENV['DB_PASS'] %>
# host: <%= ENV['DB_HOST'] %>
# port: <%= ENV['DB_PORT'] %>
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".