Writes a vote directly to avoid vote_thusly doing round trips to check if one
exists, etc.
Removes redundant transactions from controllers from #899. Rails already creates
a transaction for the .save.
Unifies Story cache updating. Previously recalculate_hotness! was called twice
on comment creation. Moves comment counting into the db.
Shorter transaction should reduce the frequence of
lobsters/lobsters-ansible/issues/39 but seems unlikely to eliminate it as the
create + upvote transactions for stories + comments still read/write from
stories, comments, and votes.
We truncated to have leading or trailing punctuation, confusing mariadb's parser
about operator usage. 'foo-bar' is ok, but 'foo-' and '-bar' are not. After
testing, mariadb splits terms at '-' anywways.
Dropped the explicit allowal of '_' because it's included in \p{Word}.
I can't take Rubocop any more. Moving up to Ruby 3 forces us to update RuboCop,
and it comes with dozens of linters that I'd have to evaluate, none of which is
a marginal improvement. I'm done having opinions.
diff of `rails routes`:
12,13d11
< GET /newest/:user(.:format) home#newest_by_user
< GET /newest/:user/page/:page(.:format) home#newest_by_user
32d29
< user_threads GET /threads/:user(.:format) comments#user_threads
120,122c117,132
< u GET /u(.:format) users#tree
< user GET /u/:username(.:format) users#show
< user_standing GET /u/:username/standing(.:format) users#standing
---
> users_tree GET /users(.:format) users#tree
> user GET /~:username(.:format) users#show
> user_standing GET /~:username/standing(.:format) users#standing
> GET /~:user/stories(/page/:page)(.:format) home#newest_by_user
> user_threads GET /~:user/threads(.:format) comments#user_threads
> user_ban POST /~:username/ban(.:format) users#ban
> user_unban POST /~:username/unban(.:format) users#unban
> user_disable_invite POST /~:username/disable_invitation(.:format) users#disable_invitation
> user_enable_invite POST /~:username/enable_invitation(.:format) users#enable_invitation
> u GET /u(.:format) redirect(302, /users)
> GET /u/:username(.:format) redirect(302, /~%{username})
> GET /@:username(.:format) redirect(302, /~%{username})
> GET /u/:username/standing(.:format) redirect(302, ~%{username}/standing)
> GET /newest/:user(.:format) redirect(302, ~%{user}/stories)
> GET /newest/:user(/page/:page)(.:format) redirect(302, ~%{user}/stories/page/%{page})
> GET /threads/:user(.:format) redirect(302, ~%{user}/threads)
125,128d134
< user_ban POST /users/:username/ban(.:format) users#ban
< user_unban POST /users/:username/unban(.:format) users#unban
< user_disable_invite POST /users/:username/disable_invitation(.:format) users#disable_invitation
< user_enable_invite POST /users/:username/enable_invitation(.:format) users#enable_invitation