Removed unused code from initial_state and ReactController

• Removed:
- unused code from initial_state and ReactController
This commit is contained in:
mgabdev 2020-11-09 12:14:42 -06:00
parent 83006eed39
commit b0e3d611f5
10 changed files with 12 additions and 25 deletions

View File

@ -71,12 +71,9 @@ class ReactController < ApplicationController
push_subscription: current_account.user.web_push_subscription(current_session), push_subscription: current_account.user.web_push_subscription(current_session),
current_account: current_account, current_account: current_account,
token: current_session.token, token: current_session.token,
admin: Account.find_local(Setting.site_contact_username.strip.gsub(/\A@/, '')),
} }
else else
{ return {}
admin: Account.find_local(Setting.site_contact_username.strip.gsub(/\A@/, '')),
}
end end
end end

View File

@ -2,7 +2,7 @@
module InstanceHelper module InstanceHelper
def site_title def site_title
Setting.site_title Setting::SITE_TITLE
end end
def site_hostname def site_hostname

View File

@ -13,12 +13,9 @@ export const boostModal = getMeta('boost_modal');
export const deleteModal = getMeta('delete_modal'); export const deleteModal = getMeta('delete_modal');
export const me = getMeta('me'); export const me = getMeta('me');
export const meUsername = getMeta('username'); export const meUsername = getMeta('username');
export const searchEnabled = getMeta('search_enabled');
export const invitesEnabled = getMeta('invites_enabled');
export const repository = getMeta('repository'); export const repository = getMeta('repository');
export const source_url = getMeta('source_url'); export const source_url = getMeta('source_url');
export const version = getMeta('version'); export const version = getMeta('version');
export const profile_directory = getMeta('profile_directory');
export const isStaff = getMeta('is_staff'); export const isStaff = getMeta('is_staff');
export const promotions = initialState && initialState.promotions; export const promotions = initialState && initialState.promotions;
export const unreadCount = getMeta('unread_count'); export const unreadCount = getMeta('unread_count');

View File

@ -18,7 +18,7 @@ class ProofProvider::Keybase::ConfigSerializer < ActiveModel::Serializer
end end
def display_name def display_name
Setting.site_title Setting::SITE_TITLE
end end
def logo def logo

View File

@ -15,6 +15,8 @@
class Setting < RailsSettings::Base class Setting < RailsSettings::Base
source Rails.root.join('config', 'settings.yml') source Rails.root.join('config', 'settings.yml')
SITE_TITLE = 'Gab Social'
def to_param def to_param
var var
end end

View File

@ -2,5 +2,5 @@
class InitialStatePresenter < ActiveModelSerializers::Model class InitialStatePresenter < ActiveModelSerializers::Model
attributes :settings, :push_subscription, :token, attributes :settings, :push_subscription, :token,
:current_account, :admin, :text :current_account, :text
end end

View File

@ -52,7 +52,4 @@ class InstancePresenter
@hero ||= Rails.cache.fetch('site_uploads/hero') { SiteUpload.find_by(var: 'hero') } @hero ||= Rails.cache.fetch('site_uploads/hero') { SiteUpload.find_by(var: 'hero') }
end end
def mascot
@mascot ||= Rails.cache.fetch('site_uploads/mascot') { SiteUpload.find_by(var: 'mascot') }
end
end end

View File

@ -13,14 +13,9 @@ class InitialStateSerializer < ActiveModel::Serializer
access_token: object.token, access_token: object.token,
locale: I18n.locale, locale: I18n.locale,
domain: Rails.configuration.x.local_domain, domain: Rails.configuration.x.local_domain,
admin: object.admin&.id&.to_s,
search_enabled: Chewy.enabled?,
repository: GabSocial::Version.repository, repository: GabSocial::Version.repository,
source_url: GabSocial::Version.source_url, source_url: GabSocial::Version.source_url,
version: GabSocial::Version.to_s, version: GabSocial::Version.to_s,
invites_enabled: Setting.min_invite_role == 'user',
mascot: instance_presenter.mascot&.file&.url,
profile_directory: Setting.profile_directory,
} }
if object.current_account if object.current_account
@ -63,7 +58,6 @@ class InitialStateSerializer < ActiveModel::Serializer
def accounts def accounts
store = {} store = {}
store[object.current_account.id.to_s] = ActiveModelSerializers::SerializableResource.new(object.current_account, serializer: REST::AccountSerializer) if object.current_account store[object.current_account.id.to_s] = ActiveModelSerializers::SerializableResource.new(object.current_account, serializer: REST::AccountSerializer) if object.current_account
store[object.admin.id.to_s] = ActiveModelSerializers::SerializableResource.new(object.admin, serializer: REST::AccountSerializer) if object.admin
store store
end end

View File

@ -10,15 +10,15 @@ class ManifestSerializer < ActiveModel::Serializer
:share_target :share_target
def name def name
object.site_title 'Gab Social'
end end
def short_name def short_name
object.site_title 'Gab Social'
end end
def description def description
strip_tags(object.site_short_description.presence || I18n.t('about.about_gabsocial_html')) 'Gab is a social network that champions free speech, individual liberty and the free flow of information online. All are welcome.'
end end
def icons def icons

View File

@ -16,7 +16,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
end end
def title def title
Setting.site_title Setting::SITE_TITLE
end end
def description def description