diff --git a/app/services/contributor_search_service.rb b/app/services/contributor_search_service.rb index 50383602..9b2be7ce 100644 --- a/app/services/contributor_search_service.rb +++ b/app/services/contributor_search_service.rb @@ -1,4 +1,8 @@ class ContributorSearchService + include ActionView::Helpers::TextHelper + include ActionView::Helpers::AssetTagHelper + include ApplicationHelper + def initialize(query, options = {}) @query = query @api_base_url = options[:url] @@ -41,7 +45,7 @@ def find_saved_accounts_with_retry(accounts) { 'id' => account.id.to_s, 'username' => account.username, - 'display_name' => account.display_name, + 'display_name' => render_custom_emojis(account.display_name), 'domain' => account.domain, 'note' => account.note, 'avatar_url' => account.avatar_url, diff --git a/app/views/communities/_form_step4.html.haml b/app/views/communities/_form_step4.html.haml index 695230db..7abae12e 100644 --- a/app/views/communities/_form_step4.html.haml +++ b/app/views/communities/_form_step4.html.haml @@ -60,13 +60,16 @@ %td{ style: 'width: 10%;' } %img{ alt: "", src: account.avatar_url, class: "rounded-circle mr-2", style: "width: 70px; height: 70px; border: 2px solid white;" } %td{ style: 'width: 80%;' } - %h6.mb-0= account.username - %p.text-muted.mb-0= raw(account.note) - %td{ style: 'width: 10%;' } + = render_custom_emojis(account.display_name) + - domain = account&.domain.present? ? "https://#{account.domain}" : ENV.fetch('MASTODON_INSTANCE_URL', nil) + %br + %a{ href: "#{account.url}", target: "_blank" }= "@#{account.username}@#{account.domain || 'channel.org'}" + %td{style: "width: 60px;"} = form_with url: unmute_contributor_community_path, method: :post, remote: true, authenticity_token: true do |form| = form.hidden_field :account_id, value: account.id %button.btn.btn-sm.btn-outline-secondary{ type: 'submit' } Unmute + .pagination.pagination-sm.m-0.float-right = paginate @muted_accounts, theme: 'bootstrap4' diff --git a/config/application.rb b/config/application.rb index 07276ddc..78ee0c3d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -6,8 +6,8 @@ require 'doorkeeper' -# require_relative '../lib/middleware/bullet_logger' -# require_relative '../lib/middleware/query_profiler' +require_relative '../lib/middleware/bullet_logger' +require_relative '../lib/middleware/query_profiler' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. diff --git a/config/initializers/bullet.rb b/config/initializers/bullet.rb index 8e4e143e..39b44f3f 100644 --- a/config/initializers/bullet.rb +++ b/config/initializers/bullet.rb @@ -1,15 +1,15 @@ -# if Rails.env.development? || Rails.env.local? -# require 'stringio' -# require 'logger' -# Bullet.enable = true -# Bullet.alert = true -# Bullet.bullet_logger = true -# Bullet.console = true -# Bullet.rails_logger = true -# Bullet.add_footer = false # Disable HTML injection for APIs +if Rails.env.development? || Rails.env.local? + require 'stringio' + require 'logger' + Bullet.enable = true + Bullet.alert = true + Bullet.bullet_logger = true + Bullet.console = true + Bullet.rails_logger = true + Bullet.add_footer = false # Disable HTML injection for APIs -# # For Postman/N+1 detection in logs: -# ActiveSupport::Notifications.subscribe('n_plus_one_query') do |event| -# Rails.logger.warn "N+1 Query detected: #{event.payload[:message]}" -# end -# end \ No newline at end of file + # For Postman/N+1 detection in logs: + ActiveSupport::Notifications.subscribe('n_plus_one_query') do |event| + Rails.logger.warn "N+1 Query detected: #{event.payload[:message]}" + end +end \ No newline at end of file diff --git a/config/initializers/rack_profiler.rb b/config/initializers/rack_profiler.rb index 5485c3fe..ccdf4841 100644 --- a/config/initializers/rack_profiler.rb +++ b/config/initializers/rack_profiler.rb @@ -1,13 +1,13 @@ -return unless Rails.env.development? +if Rails.env.development? + begin + require 'rack-mini-profiler' -begin - require 'rack-mini-profiler' + # Start the profiler + ::Rack::MiniProfilerRails.initialize!(Rails.application) - # Start the profiler - ::Rack::MiniProfilerRails.initialize!(Rails.application) - - # Optional: Customize settings - Rack::MiniProfiler.config.position = 'bottom' # display at bottom of page -rescue LoadError => e - Rails.logger.warn "rack-mini-profiler not available: #{e.message}" + # Optional: Customize settings + Rack::MiniProfiler.config.position = 'bottom' # display at bottom of page + rescue LoadError => e + Rails.logger.warn "rack-mini-profiler not available: #{e.message}" + end end \ No newline at end of file diff --git a/lib/middleware/bullet_logger.rb b/lib/middleware/bullet_logger.rb index 12082255..23f43a90 100644 --- a/lib/middleware/bullet_logger.rb +++ b/lib/middleware/bullet_logger.rb @@ -1,25 +1,25 @@ -# class BulletLogger -# def initialize(app) -# @app = app -# end +class BulletLogger + def initialize(app) + @app = app + end -# def call(env) -# warnings = [] -# subscriber = ActiveSupport::Notifications.subscribe('n_plus_one_query') do |event| -# warnings << event.payload[:message] rescue nil -# end + def call(env) + warnings = [] + subscriber = ActiveSupport::Notifications.subscribe('n_plus_one_query') do |event| + warnings << event.payload[:message] rescue nil + end -# status, headers, response = @app.call(env) + status, headers, response = @app.call(env) -# ActiveSupport::Notifications.unsubscribe(subscriber) + ActiveSupport::Notifications.unsubscribe(subscriber) -# if warnings.any? -# headers['X-N-Plus-One-Warnings'] = warnings.to_json -# end + if warnings.any? + headers['X-N-Plus-One-Warnings'] = warnings.to_json + end -# [status, headers, response] -# rescue => e -# Rails.logger.error "BulletLogger Error: #{e.message}" -# @app.call(env) # Fallback to original request -# end -# end \ No newline at end of file + [status, headers, response] + rescue => e + Rails.logger.error "BulletLogger Error: #{e.message}" + @app.call(env) # Fallback to original request + end +end \ No newline at end of file