From 302f532440d0bfad1784d9b696e099af9d5a3246 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Tue, 10 Dec 2019 05:33:44 -0600 Subject: fix newlines in normalized text + make `tag` & `tags` headings mean the same thing --- app/helpers/search_helper.rb | 4 ++-- app/helpers/text_helper.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 991ba533b..9510abe99 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -7,8 +7,8 @@ module SearchHelper if query.include?(':') query_parts = query.split(':', 2) - if query_parts[0] == 'tags' - query = "^tags .*(#{query_parts[1].split.join('|')})" + if %w(tag tags).include?(query_parts[0]) + query = "^tag (#{query_parts[1].split.join('|')})" elsif %w(subj text desc).include?(query_parts[0]) query = "^#{query_parts[0]} .*#{query_parts[1]}" end diff --git a/app/helpers/text_helper.rb b/app/helpers/text_helper.rb index ac49e56f0..50a7c248a 100644 --- a/app/helpers/text_helper.rb +++ b/app/helpers/text_helper.rb @@ -29,12 +29,12 @@ module TextHelper end def normalize_status(status) - "#{_format_tags(status)}\n#{_format_spoiler(status)}\n#{_format_status(status)}\n#{_format_desc(status)}".delete("\n\n").strip + "#{_format_tags(status)}\n#{_format_spoiler(status)}\n#{_format_status(status)}\n#{_format_desc(status)}".strip end def _format_tags(status) return unless status.tags.present? - "tags #{status.tags.pluck(:name).join("\ntags ")}" + "tag #{status.tags.pluck(:name).join("\ntag ")}" end def _format_spoiler(status) -- cgit