Merge branch 'develop' of https://code.gab.com/gab/social/gab-social into develop
This commit is contained in:
commit
6821909a3f
@ -10,6 +10,7 @@ class Auth::SessionsController < Devise::SessionsController
|
|||||||
prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create]
|
prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create]
|
||||||
before_action :set_instance_presenter, only: [:new]
|
before_action :set_instance_presenter, only: [:new]
|
||||||
before_action :set_body_classes
|
before_action :set_body_classes
|
||||||
|
before_action :use_master
|
||||||
|
|
||||||
def new
|
def new
|
||||||
Devise.omniauth_configs.each do |provider, config|
|
Devise.omniauth_configs.each do |provider, config|
|
||||||
@ -35,6 +36,10 @@ class Auth::SessionsController < Devise::SessionsController
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def use_master
|
||||||
|
User.connection.stick_to_master!
|
||||||
|
end
|
||||||
|
|
||||||
def find_user
|
def find_user
|
||||||
if session[:otp_user_id]
|
if session[:otp_user_id]
|
||||||
User.find(session[:otp_user_id])
|
User.find(session[:otp_user_id])
|
||||||
|
@ -291,7 +291,11 @@ class Status < ApplicationRecord
|
|||||||
|
|
||||||
def as_home_timeline(account)
|
def as_home_timeline(account)
|
||||||
query = where('created_at > ?', 10.days.ago)
|
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
|
query.where(account: [account] + account.following).without_replies
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -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?
|
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))
|
@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?)
|
hasVideoOrGif = @media.find(&:video?) || @media.find(&:gifv?)
|
||||||
|
@ -7,11 +7,23 @@ default: &default
|
|||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: <%= ENV['DB_NAME'] || 'gabsocial_development' %>
|
adapter: postgresql_makara
|
||||||
username: <%= ENV['DB_USER'] %>
|
prepared_statements: false
|
||||||
password: <%= ENV['DB_PASS'] %>
|
makara:
|
||||||
host: <%= ENV['DB_HOST'] %>
|
id: postgres
|
||||||
port: <%= ENV['DB_PORT'] %>
|
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
|
# Warning: The database defined as "test" will be erased and
|
||||||
# re-generated from your development database when you run "rake".
|
# re-generated from your development database when you run "rake".
|
||||||
|
Loading…
x
Reference in New Issue
Block a user