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),
current_account: current_account,
token: current_session.token,
admin: Account.find_local(Setting.site_contact_username.strip.gsub(/\A@/, '')),
}
else
{
admin: Account.find_local(Setting.site_contact_username.strip.gsub(/\A@/, '')),
}
else
return {}
end
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,14 +13,9 @@ class InitialStateSerializer < ActiveModel::Serializer
access_token: object.token,
locale: I18n.locale,
domain: Rails.configuration.x.local_domain,
admin: object.admin&.id&.to_s,
search_enabled: Chewy.enabled?,
repository: GabSocial::Version.repository,
source_url: GabSocial::Version.source_url,
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
@ -63,7 +58,6 @@ class InitialStateSerializer < ActiveModel::Serializer
def accounts
store = {}
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
end

View File

@ -10,15 +10,15 @@ class ManifestSerializer < ActiveModel::Serializer
:share_target
def name
object.site_title
'Gab Social'
end
def short_name
object.site_title
'Gab Social'
end
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
def icons

View File

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