Commit Graph

21 Commits

Author SHA1 Message Date
evazion
5f1c296011 tags: don't allow tags with unbalanced parentheses.
Don't allow tags to have unbalanced parentheses, except for a few
emoticon tags as special exceptions to the rule.
2022-04-17 23:20:22 -05:00
evazion
90be15e0b5 Fix #4973: Wiki pages json index returns 404.
Fix regression introduced in 0db20e0ca. Setting `format: false` on the
wiki pages resource disabled format negotiation on all wiki page routes,
not just the show page, which meant /wiki_pages.json no longer worked.

The fix to monkey patch the internal Rails method that parses the file
extension from the URL, and have it ignore everything but the .html,
.json, .js, and .xml extensions. This is really hacky and may break in
future Rails releases.
2022-01-22 16:52:20 -06:00
evazion
67b96135dd Make Symbol#to_s return frozen string.
Monkey-patch Symbol#to_s to return a frozen (immutable) string instead
of a mutable string.

This should reduce string allocations, and thereby reduce memory usage
and garbage collector pressure, but it may be incompatible with
libraries that expect Symbol#to_s to return a mutable string.

https://bugs.ruby-lang.org/issues/16150
https://github.com/Shopify/symbol-fstring
2021-12-14 21:33:27 -06:00
evazion
b79bd8407f Remove FalseClass#to_i core extension.
Remove a monkey patch that added a `to_i` method to `FalseClass` so that
`false.to_i` returned 0. This is legacy code that shouldn't still be in
use anywhere. It doesn't really work anyway, because `true.to_i` isn't
defined.
2021-03-11 17:34:05 -06:00
evazion
d18dc573fb artists: fix misnormalization of emoji in other names.
Fix `normalize_whitespace` to not strip zero-width joiner characters
(U+200D). These characters are used in emoji and stripping them breaks
some artist other names that use emoji.
2021-01-10 02:46:20 -06:00
evazion
efb836ac02 wikis: normalize Unicode characters in wiki bodies.
* Introduce an abstraction for normalizing attributes. Very loosely
  modeled after https://github.com/fnando/normalize_attributes.
* Normalize wiki bodies to Unicode NFC form.
* Normalize Unicode space characters in wiki bodies (strip zero width
  spaces, normalize line endings to CRLF, normalize Unicode spaces to
  ASCII spaces).
* Trim spaces from the start and end of wiki page bodies. This may cause
  wiki page diffs to show spaces being removed even when the user didn't
  explicitly remove the spaces themselves.
2020-12-21 20:47:50 -06:00
evazion
2c1da660fd tags: allow tag abbreviations in searches and during tagging.
Expand the tag abbreviation system introduced in b0be8ae45 so that it
works in searches and when tagging posts, not just in autocomplete.

For example, you can tag a post with /evth and it will add the tag
eyebrows_visible_through_hair. You can search for /evth and it will
search for the tag eyebrows_visible_through_hair.

Some more examples:

* /ops is short for one-piece_swimsuit
* /hooe is short for hair_over_one_eye
* /saol is short for standing_on_one_leg
* /tlozbotw is short for the_legend_of_zelda:_breath_of_the_wild

If two tags have the same abbreviation, then the larger tag takes
precedence. For example, /be is short for blue_eyes, not brown_eyes,
because blue_eyes is the bigger tag.

If there is an existing shortcut alias that conflicts with the
abbreviation, then the alias take precedence. For example, /sh is short
for suzumiya_haruhi, not short_hair, because there's an old alias for
/sh -> suzumiya_haruhi.
2020-12-17 23:57:13 -06:00
evazion
a181e6d0db Fix #1898: Include alias predicates in non-empty Tags search.
Make searches on the /tags index includes aliases too. Show matching
aliases like this:

   Name: gray*

   ? 75098 grey_hair <- gray_hair
   ? 35345 grey_eyes <- gray_eyes
2020-02-23 00:29:17 -06:00
evazion
c7492343ce String: add truthy? & falsy? core extensions.
* Add `truthy?` and `falsy?` core extensions to String.

* Use `truthy?` and `falsy?` to replace ad-hoc parsing of boolean
  parameters in various places.
2018-05-03 19:57:14 -05:00
evazion
cebf29f83e Allow escaping wildcards (\*) in wildcard searches. 2017-05-31 16:15:18 -05:00
evazion
cf54cd1480 core_extensions.rb: remove unused String#to_escaped_js. 2017-02-06 19:07:04 -06:00
r888888888
701ed9d161 fixes #2162 2014-05-22 14:54:19 -07:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
8f65b567a2 fixes #796 2013-03-08 13:44:34 -05:00
albert
2338f004eb refactored tsquery sql to use rails escaping mechanisms 2013-03-07 16:34:12 -05:00
albert
cca0cc8dbd fix pool metatags, fix artist search 2013-02-26 23:35:17 -08:00
albert
cf2250a17f fixes #638 2013-02-26 22:56:16 -08:00
albert
49b3d43ddd * meta_search now pulls directly from GitHub
* Updated gems
* [inprogress] New pagination helpers used instead of pagination presenters
* [inprogress] Favorites refactored to use ActiveRecord
* [inprogress] PostSets refactored to use a decorator/dependency injection pattern
* [inprogress] Made pool/post interaction more robust
* Pool#posts now returns an ActiveRelation object
* Fixed unit tests
2011-06-07 17:34:09 -04:00
albert
5610731b35 sync 2010-08-18 18:42:33 -04:00
Albert Yi
3bfae1f0db added user test, basic user methods 2010-02-06 16:48:40 -05:00