Module: PatchworkHelper
- Extended by:
- ActiveSupport::Concern
- Included in:
- LongPost::StatusLengthValidatorPatch, NewsmastMastodon::Concerns::AccountsCreation, NewsmastMastodon::Concerns::UserConcern, NewsmastMastodon::LoginService, NewsmastMastodon::Overrides::ExtendedAccountStatusesFilter
- Defined in:
- app/helpers/patchwork_helper.rb
Overview
Merged from:
accounts/app/helpers/patchwork_helper.rb (checked for Accounts::ServerSetting / Accounts::CommunityAdmin)
posts/app/helpers/patchwork_helper.rb (checked for Posts::ServerSetting / Posts::CommunityAdmin)
After consolidation both collapse to NewsmastMastodon::ServerSetting and NewsmastMastodon::CommunityAdmin, so there is now a single unified helper.
Instance Method Summary collapse
- #patchwork_community_admin_exist? ⇒ Boolean
- #patchwork_server_settings_exist? ⇒ Boolean
- #patchwork_table_exists?(table_name) ⇒ Boolean
Instance Method Details
#patchwork_community_admin_exist? ⇒ Boolean
28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/patchwork_helper.rb', line 28 def patchwork_community_admin_exist? return false unless patchwork_table_exists?('patchwork_communities_admins') return false unless Object.const_defined?('NewsmastMastodon::CommunityAdmin') && defined?(NewsmastMastodon::CommunityAdmin) && NewsmastMastodon::CommunityAdmin.respond_to?(:find_by) true end |
#patchwork_server_settings_exist? ⇒ Boolean
18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/patchwork_helper.rb', line 18 def patchwork_server_settings_exist? return false unless patchwork_table_exists?('server_settings') return false unless Object.const_defined?('NewsmastMastodon::ServerSetting') && defined?(NewsmastMastodon::ServerSetting) && NewsmastMastodon::ServerSetting.respond_to?(:find_by) true end |
#patchwork_table_exists?(table_name) ⇒ Boolean
12 13 14 15 16 |
# File 'app/helpers/patchwork_helper.rb', line 12 def patchwork_table_exists?(table_name) ActiveRecord::Base.connection.data_source_exists?(table_name) rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished, PG::ConnectionBad false end |