Commit Graph

338 Commits

Author SHA1 Message Date
Peter Bhat Harkins b3d6903f05 standardrb: standard-rails 2023-09-14 08:45:21 -05:00
Peter Bhat Harkins a04e70a069 fix display of story scores, broken in ab44dcdb 2023-09-13 18:26:17 -05:00
Peter Bhat Harkins ab44dcdbf6 align name of Story and Comment current_vote, convenience methods 2023-09-13 11:10:44 -05:00
Peter Bhat Harkins d11b222a50 parse search queries 2023-09-13 10:24:05 -05:00
Peter Bhat Harkins c3f8625788 standardrb
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.
2023-09-08 15:39:50 -05:00
Peter Bhat Harkins 27e2f29c68 fix Stories.not_deleted when joined to saved_stories for /saved 2023-08-31 11:51:40 -05:00
Peter Bhat Harkins 7f82650795 show merged stories on newest_by_user, deleted to submitter 2023-08-30 17:47:41 -05:00
Peter Bhat Harkins 7298381360 don't log changes to normalized_url 2023-08-30 11:10:59 -05:00
Peter Bhat Harkins 9fff6ae927 enable mod_userdir
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
2023-08-29 07:49:02 -05:00
Peter Bhat Harkins 7463e444fb perf: rm two queries for counting similar stories on story show
also cleans out the last of the work scripts for the branch
2023-08-28 17:40:13 -05:00
Peter Bhat Harkins 42d3ad4c30 find similar_stories by normalizing, not regexping
Big performance win to drop a query that regexps every URL in stories (400-650ms
in prod).

Fix #931
Relates to #932
2023-08-28 17:35:11 -05:00
Peter Bhat Harkins f489c8ae3b Separate merged_comments from sorting + preloading 2023-08-24 03:13:30 -05:00
Peter Bhat Harkins ace23832fe rm dead calls to arrange_for_user 2023-08-24 02:54:26 -05:00
Peter Bhat Harkins 0f9ddbfa69 materialize confidence_order column 2023-08-24 02:54:26 -05:00
Peter Bhat Harkins 1e874622ce less bad name for ordering 2023-08-24 02:54:26 -05:00
Peter Bhat Harkins 8dd88017a8 fixed paste 2023-08-24 02:54:26 -05:00
Peter Bhat Harkins daaf1ee086 setup for selected bytepack w cache 2023-08-24 02:54:26 -05:00
Peter Bhat Harkins beab5b8e0c setup for selected perf test 2023-08-24 02:54:26 -05:00
Peter Bhat Harkins fabc8381de quick fix to #1174 to prevent 500s 2023-07-27 08:53:08 -05:00
Patryk f3ab19ee1c
Add youtube duplicate detection (#1174) 2023-04-26 08:21:05 -05:00
Peter Bhat Harkins 7c999c37c8 remove common GitHub title cruft 2023-02-22 00:25:54 -06:00
Fat Shinobi f10529e727
Domains: web editing, transparency in tracker banning (#1119) 2022-08-31 13:23:33 +00:00
Peter Bhat Harkins 3e74f10d1b check_url_dupe: don't 500 on bot hits
A couple sites hit this endpoint so they can find submitted stories; if they
seem to be resubmitting a recently-submitted story this would 500.
2022-08-12 10:26:18 -05:00
Peter Bhat Harkins dfad80a322 mod always allowed to edit story URL 2022-07-26 06:39:57 -05:00
Peter Bhat Harkins 44c89a5e62 permit up arrow for knuth notation 2022-06-22 08:54:03 -05:00
Peter Bhat Harkins c475326c39 perf attempt: refactor to remove dependent subquery
old Story.filter_tags([1, 2, 3]):
Story.where.not( Tagging.select('TRUE').where('taggings.story_id = stories.id').where(tag_id: [1, 2, 3]).arel.exists)
SELECT `stories`.* FROM `stories` WHERE NOT (EXISTS (SELECT TRUE FROM `taggings` WHERE (taggings.story_id = stories.id) AND `taggings`.`tag_id` IN (1, 2, 3)))

new Story.filter_tags([1, 2, 3]):
Story.where(Story.arel_table[:id].not_in(Tagging.where(tag_id: [1, 2, 3]).select(:story_id).arel))
  SELECT `stories`.* FROM `stories` WHERE `stories`.`id` NOT IN (SELECT `taggings`.`story_id` FROM `taggings` WHERE `taggings`.`tag_id` IN (1, 2, 3))

same story for Story.filter_tags_for(1):
Story.where(Story.arel_table[:id].not_in(Tagging.joins(tag: :tag_filters).where(tag_filters: { user_id: 1 }).select(:story_id).arel))
  SELECT `stories`.* FROM `stories` WHERE `stories`.`id` NOT IN (SELECT `taggings`.`story_id` FROM `taggings` INNER JOIN `tags` ON `tags`.`id` = `taggings`.`tag_id` INNER JOIN `tag_filters` ON `tag_filters`.`tag_id` = `tags`.`id` WHERE `tag_filters`.`user_id` = 78)

So this is a clear improvement... but the EXPLAIN is exactly the same, MariaDB
recognized the opportunity:
+------+--------------+----------+-------+------------------------------------+-----------------+---------+------+-------+--------------------------+
| id   | select_type  | table    | type  | possible_keys                      | key             | key_len | ref  | rows  | Extra                    |
+------+--------------+----------+-------+------------------------------------+-----------------+---------+------+-------+--------------------------+
|    1 | PRIMARY      | stories  | ALL   | NULL                               | NULL            | NULL    | NULL | 85056 | Using where              |
|    2 | MATERIALIZED | taggings | index | story_id_tag_id,taggings_tag_id_fk | story_id_tag_id | 16      | NULL | 1     | Using where; Using index |
+------+--------------+----------+-------+------------------------------------+-----------------+---------+------+-------+--------------------------+

So this is a no-op on MariaDB, but I'm making the change because the
ActiveRecord is easier to read. Credit to Aaron Francis and Colleen Schnettler.
2022-06-08 08:18:11 -05:00
Calvin Buckley 00d29daeb7
Plain text of comments and stories in json (#975) 2022-05-11 13:09:03 +00:00
Peter Bhat Harkins 0f8d5e5143 preload suggestions to avoid 1 + n for mods 2022-03-04 09:18:53 -06:00
Peter Bhat Harkins b40633eb53 fixups, rubocop 2022-02-21 19:03:52 -06:00
Peter Bhat Harkins 03cbb60d66 stop accepting comments after 90d to avoid /active promoting thread necro 2022-02-19 22:05:10 -06:00
Peter Bhat Harkins 6a84f47205 /active 2022-02-19 20:37:13 -06:00
Peter Bhat Harkins 707b2b30ae close suggestions after mod edit 2022-02-08 22:20:41 -06:00
Peter Bhat Harkins dba88ba6c8 Story: rename expired -> deleted to match usage 2022-02-08 22:20:41 -06:00
Peter Bhat Harkins d05affbe41 always show deleted stories to mods
I deliberately didn't set a (user=nil) default for the arg; I'd rather get a
few 500s for any places that I missed updating than silently drop stories.
2022-02-06 16:36:57 -06:00
Peter Bhat Harkins 8fe3a7f248 /about: explain new user restrictions; better error messages 2022-01-29 10:53:31 -06:00
lvancraen 27180bd1e7 chore: update moderation log to include all changes 2022-01-22 15:37:02 -06:00
Peter Bhat Harkins 39d5fd4c57 nitpicky tweaks, s/cache/archive/ 2022-01-22 09:18:19 -06:00
alternet0 81f03909fc Update story.rb 2022-01-22 08:58:26 -06:00
Peter Bhat Harkins 7d52e54221 quietly accept dupe comments
Fix #967
2022-01-18 21:52:59 -06:00
Peter Bhat Harkins 6301dea8a6 recognize dashes in URLs
Fix #1044
2022-01-04 08:33:32 -06:00
alternet0 c80aa2e1fa Filter additional tracking query parameters (#1047)
https://support.google.com/google-ads/answer/9744275?hl=en
https://support.google.com/optimize/answer/6361119?hl=en#zippy=%2Cexample-parameters-in-redirect-destination-dont-conflict
2021-12-30 17:35:30 -05:00
Prabu Weerasinghe 9041e3df49
Recognize Arvix html and pdf urls as duplicates (#965) 2021-10-25 22:19:45 +00:00
Peter Bhat Harkins 5f5fa8ef03 subtract comment/story karma if mod removes
Matches impact of the comment/story by using the vote count as a penalty.
Flags effectively count extra because they -1 when applied and -2 when the mod
removes.
2020-12-14 12:07:40 -06:00
Peter Bhat Harkins 013b5c5529 don't count removed stories towards lifting anti-spam protection 2020-11-06 10:49:10 -06:00
Peter Bhat Harkins 2cf313e6e2 coalesce nulls to zero 2020-09-14 08:31:09 -05:00
Peter Bhat Harkins ecc8b5873b nil possible on pdfs 2020-09-10 22:33:14 -05:00
Peter Bhat Harkins 823a147ad0 perf: Story.has_suggestions? 2020-09-02 14:13:27 -05:00
Peter Bhat Harkins dd2e74f63a use preloaded tags to save 1 + n queries 2020-09-02 14:13:27 -05:00
Ron Wolf 4361a7ace5
clean up Story#can_be_seen_by_user? (#921) 2020-08-26 01:35:03 +00:00
Peter Bhat Harkins c39561f2f3 story_text may not be present 2020-08-25 09:39:21 -05:00