Merge branch 'develop' of https://code.gab.com/gab/social/gab-social into develop
This commit is contained in:
commit
ccf98d2002
@ -34,6 +34,15 @@ class Api::V1::Statuses::FavouritesController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def requested_status
|
def requested_status
|
||||||
Status.find(params[:status_id])
|
rs = nil
|
||||||
|
begin
|
||||||
|
rs = Status.find(params[:status_id])
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
Status.connection.stick_to_master!
|
||||||
|
rs = Status.find(params[:status_id])
|
||||||
|
end
|
||||||
|
return rs unless rs.nil?
|
||||||
|
raise ActiveRecord::RecordNotFound
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -31,7 +31,15 @@ class Api::V1::Statuses::ReblogsController < Api::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def status_for_reblog
|
def status_for_reblog
|
||||||
Status.find params[:status_id]
|
rs = nil
|
||||||
|
begin
|
||||||
|
rs = Status.find(params[:status_id])
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
Status.connection.stick_to_master!
|
||||||
|
rs = Status.find(params[:status_id])
|
||||||
|
end
|
||||||
|
return rs unless rs.nil?
|
||||||
|
raise ActiveRecord::RecordNotFound
|
||||||
end
|
end
|
||||||
|
|
||||||
def status_for_destroy
|
def status_for_destroy
|
||||||
|
@ -8,7 +8,7 @@ class SortingQueryBuilder < BaseService
|
|||||||
min_reblogs = 2
|
min_reblogs = 2
|
||||||
min_replies = 1
|
min_replies = 1
|
||||||
date_limit = 5.years.ago
|
date_limit = 5.years.ago
|
||||||
pure_limit = "NOW() - INTERVAL '14 days'"
|
pure_limit = "NOW() - INTERVAL '3 days'"
|
||||||
max_page = 8
|
max_page = 8
|
||||||
|
|
||||||
case sort_type
|
case sort_type
|
||||||
@ -80,11 +80,12 @@ class SortingQueryBuilder < BaseService
|
|||||||
|
|
||||||
query += "
|
query += "
|
||||||
) q
|
) q
|
||||||
left join custom_filters cf
|
|
||||||
on cf.account_id = #{account_id}
|
|
||||||
and q.text like '%' || cf.phrase || '%'
|
|
||||||
where cf.id is null
|
|
||||||
"
|
"
|
||||||
|
#left join custom_filters cf
|
||||||
|
# on cf.account_id = #{account_id}
|
||||||
|
# and q.text like '%' || cf.phrase || '%'
|
||||||
|
#where cf.id is null
|
||||||
|
#"
|
||||||
return Status.find_by_sql query
|
return Status.find_by_sql query
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,7 +33,13 @@ class HomeFeed < Feed
|
|||||||
and s.reply is false
|
and s.reply is false
|
||||||
and (
|
and (
|
||||||
s.account_id = #{@id}
|
s.account_id = #{@id}
|
||||||
or s.account_id in (select target_account_id from follows where account_id = #{@id})
|
or s.account_id in (
|
||||||
|
select ff.target_account_id
|
||||||
|
from follows ff
|
||||||
|
join accounts af
|
||||||
|
on ff.target_account_id = af.id
|
||||||
|
and af.updated_at > NOW() - INTERVAL '7 days'
|
||||||
|
where ff.account_id = #{@id})
|
||||||
)
|
)
|
||||||
and s.account_id not in (select target_account_id from mutes where account_id = #{@id})
|
and s.account_id not in (select target_account_id from mutes where account_id = #{@id})
|
||||||
and (reblog.id is null or reblog.account_id not in (select target_account_id from mutes where account_id = #{@id}))
|
and (reblog.id is null or reblog.account_id not in (select target_account_id from mutes where account_id = #{@id}))
|
||||||
@ -45,12 +51,13 @@ class HomeFeed < Feed
|
|||||||
) st
|
) st
|
||||||
left join statuses rb
|
left join statuses rb
|
||||||
on st.reblog_of_id = rb.id
|
on st.reblog_of_id = rb.id
|
||||||
left join custom_filters cf
|
|
||||||
on cf.account_id = #{@id} and (
|
|
||||||
st.text like '%' || cf.phrase || '%'
|
|
||||||
or rb.text like '%' || cf.phrase || '%')
|
|
||||||
where cf.id is null or st.account_id = #{@id}
|
|
||||||
"
|
"
|
||||||
|
# left join custom_filters cf
|
||||||
|
# on cf.account_id = #{@id} and (
|
||||||
|
# st.text like '%' || cf.phrase || '%'
|
||||||
|
# or rb.text like '%' || cf.phrase || '%')
|
||||||
|
# where cf.id is null or st.account_id = #{@id}
|
||||||
|
#"
|
||||||
# .reject { |status| FeedManager.instance.filter?(:home, status, @account.id) }
|
# .reject { |status| FeedManager.instance.filter?(:home, status, @account.id) }
|
||||||
# Status.as_home_timeline(@account)
|
# Status.as_home_timeline(@account)
|
||||||
# .paginate_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
|
# .paginate_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
|
||||||
|
@ -10,7 +10,14 @@ class FavouriteService < BaseService
|
|||||||
def call(account, status)
|
def call(account, status)
|
||||||
authorize_with account, status, :favourite?
|
authorize_with account, status, :favourite?
|
||||||
|
|
||||||
favourite = Favourite.find_by(account: account, status: status)
|
favourite = nil
|
||||||
|
begin
|
||||||
|
favourite = Favourite.find_by(account: account, status: status)
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
Favourite.connection.stick_to_master!
|
||||||
|
favourite = Favourite.find_by(account: account, status: status)
|
||||||
|
end
|
||||||
|
# favourite = Favourite.find_by(account: account, status: status)
|
||||||
|
|
||||||
return favourite unless favourite.nil?
|
return favourite unless favourite.nil?
|
||||||
|
|
||||||
|
@ -13,7 +13,14 @@ class ReblogService < BaseService
|
|||||||
|
|
||||||
authorize_with account, reblogged_status, :reblog?
|
authorize_with account, reblogged_status, :reblog?
|
||||||
|
|
||||||
reblog = account.statuses.find_by(reblog: reblogged_status)
|
reblog = nil
|
||||||
|
begin
|
||||||
|
reblog = account.statuses.find_by(reblog: reblogged_status)
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
account.statuses.connection.stick_to_master!
|
||||||
|
reblog = account.statuses.find_by(reblog: reblogged_status)
|
||||||
|
end
|
||||||
|
#reblog = account.statuses.find_by(reblog: reblogged_status)
|
||||||
|
|
||||||
return reblog unless reblog.nil?
|
return reblog unless reblog.nil?
|
||||||
|
|
||||||
|
@ -16,6 +16,10 @@ Rails.application.routes.draw do
|
|||||||
mount PgHero::Engine, at: 'pghero', as: :pghero
|
mount PgHero::Engine, at: 'pghero', as: :pghero
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Doorkeeper::AccessToken.connection.stick_to_master!
|
||||||
|
Doorkeeper::AccessGrant.connection.stick_to_master!
|
||||||
|
SessionActivation.connection.stick_to_master!
|
||||||
|
|
||||||
use_doorkeeper do
|
use_doorkeeper do
|
||||||
controllers authorizations: 'oauth/authorizations',
|
controllers authorizations: 'oauth/authorizations',
|
||||||
authorized_applications: 'oauth/authorized_applications',
|
authorized_applications: 'oauth/authorized_applications',
|
||||||
@ -225,9 +229,9 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
|
|
||||||
namespace :chat_conversation_accounts do
|
namespace :chat_conversation_accounts do
|
||||||
#
|
#
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :chat_conversation_accounts, only: :show do
|
resources :chat_conversation_accounts, only: :show do
|
||||||
member do
|
member do
|
||||||
post :messenger_block_relationships
|
post :messenger_block_relationships
|
||||||
@ -365,7 +369,7 @@ Rails.application.routes.draw do
|
|||||||
resource :removed_accounts, only: [:show, :create, :destroy], controller: 'groups/removed_accounts'
|
resource :removed_accounts, only: [:show, :create, :destroy], controller: 'groups/removed_accounts'
|
||||||
resource :password, only: [:create], controller: 'groups/password'
|
resource :password, only: [:create], controller: 'groups/password'
|
||||||
resource :join_requests, only: [:show], controller: 'groups/requests'
|
resource :join_requests, only: [:show], controller: 'groups/requests'
|
||||||
|
|
||||||
post '/join_requests/respond', to: 'groups/requests#respond_to_request'
|
post '/join_requests/respond', to: 'groups/requests#respond_to_request'
|
||||||
|
|
||||||
resource :pin, only: [:show, :create], controller: 'groups/pins'
|
resource :pin, only: [:show, :create], controller: 'groups/pins'
|
||||||
|
Loading…
Reference in New Issue
Block a user