Commit Graph

2728 Commits

Author SHA1 Message Date
Ben Harris 9e4b0e1b27 fix application path 2024-01-16 14:17:08 -05:00
Ben Harris c3b9cab8a9 use my diffbot replacement using php-readability 2024-01-16 14:05:31 -05:00
Kevin Nobel 8fce00add7 Replace Lobsters logo with ~news logo (#6) 2024-01-16 14:04:56 -05:00
Ben Harris aed4bf903c tilde.news customizations 2024-01-16 14:04:51 -05:00
Peter Bhat Harkins 4c01d77714 fix divide by zero if stddev is <1 2024-01-02 12:35:25 -06:00
Peter Bhat Harkins 4fd296e508 finish /u redirect from 9fff6ae9 with 301s 2024-01-02 10:45:00 -06:00
Peter Bhat Harkins ac3b88c72a clear other (?) json/page cache (#1219) 2023-12-30 10:22:14 -06:00
Peter Bhat Harkins 0a3c782eec better name for Story#check_not_tracking_domain 2023-12-29 09:00:21 -06:00
Peter Bhat Harkins 2332d28022 bump gems except commonmarker (#1234)
lot of irritating churn out of standardrb here
2023-12-28 19:26:56 -06:00
Peter Bhat Harkins 623f8f851a bump framework defaults to 7.1 2023-12-28 10:59:39 -06:00
Peter Bhat Harkins 7e5e813474 bump framework defaults to 7.0 2023-12-28 10:59:39 -06:00
Tiago Ilieve a5a41e11f1 Show merged stories on duplicate submission 2023-12-27 08:27:33 -06:00
Peter Bhat Harkins 9a9362f3bb bump to current brakeman 2023-12-26 10:28:33 -06:00
Peter Bhat Harkins 1faa617707 don't expire cache dirs
There's not many of them, and there's a race condition where this script deletes
a dir at the same time the rails page cache wants to write a new file to it,
leading to 500s.
2023-12-25 09:26:27 -06:00
Peter Bhat Harkins 1caa4757d0 Rails 7.1 2023-12-23 22:41:35 -06:00
Peter Bhat Harkins 3f052e4e99 save ~20ms from view render time 2023-12-22 21:28:11 -06:00
Peter Bhat Harkins 5ed3a29888 catch a failure mode 2023-12-22 21:28:11 -06:00
Tiago Ilieve e55ca717c0 Fix long lines in moderation action description
Lines containing a long URL, for instance, would cause the text to
overflow its content box.
2023-12-22 08:37:33 -06:00
Peter Bhat Harkins 163b20e41b run db:seed task in setup (#1230) 2023-12-20 08:41:07 -06:00
Peter Bhat Harkins 9ed75818fb update for new location 2023-12-19 10:56:45 -06:00
Peter Bhat Harkins cdde144b0d spec update for previous 2023-12-17 21:09:51 -06:00
Peter Bhat Harkins b45d175083 add brakeman
Wrote ignore notes and specs for the security assumptions implied.
Removed TZ from moderations table; everything is Chicago time, best time.
2023-12-17 20:22:47 -06:00
Peter Bhat Harkins e77495999e specs for previous 2023-12-13 12:12:29 -06:00
Peter Bhat Harkins ff19562026 add threading headers to reply notifications 2023-12-13 11:47:01 -06:00
Peter Bhat Harkins 9500e23ef1
Normalize rfc-editor.org links #1225 #1223 2023-12-06 09:26:28 -06:00
Peter Bhat Harkins d8ea92a140 set up db the reasonable way 2023-12-06 09:21:51 -06:00
Peter Bhat Harkins 1f4547d2b9 automate a bit with bin/setup 2023-12-06 08:50:04 -06:00
Peter Bhat Harkins 35925eb0e1
Merge pull request #1229 from internethostage/feature/bring_tag_colors_to_edit_form
Feature - Bring tag colors to edit form
2023-12-05 12:09:49 -06:00
Cristian Guerrero e801eae40d Remove unused css 2023-12-05 12:09:14 -05:00
Cristian Guerrero ccbda01634 Add the tag css details from data to the js generated tag entries
Also change div to a so that we can reuse the tag css styling
2023-12-05 12:09:14 -05:00
Cristian Guerrero 0b4b34afad Add the tag css classes to dropdown options data 2023-12-05 12:07:08 -05:00
Peter Bhat Harkins aa060669d5 wrap message IDs with <> in References header; #1227 2023-12-04 09:26:36 -06:00
Peter Bhat Harkins ff34ce9872 fix #1227 email Date header, bug from 4dd0fe8 2023-12-04 09:11:47 -06:00
Micah Magruder 348d754428 Add rfc-editor info links to spec test 2023-12-01 16:51:06 -05:00
Micah Magruder 3327c4be9b Normalize rfc-editor.org links 2023-12-01 16:39:51 -05:00
Peter Bhat Harkins 8722f4229c missing migration in schema; standardrb generated file 2023-11-22 11:17:57 -06:00
Peter Bhat Harkins 3d4b2c2b2d fix #1224 email reply to whom 2023-11-22 11:08:08 -06:00
Peter Bhat Harkins bc27b2c929 fix exception on anon viewing reply form 2023-11-22 10:13:58 -06:00
Peter Bhat Harkins 88c7a4a972
Merge pull request #1218 from joancodes/feature/add-email-visibility-toggle
Add profile toggle value to optionally show your e-mail address to authenticated users
2023-11-15 15:20:11 +00:00
Peter Bhat Harkins 8078e5d576 run migrations before tests 2023-11-15 09:16:46 -06:00
Robey Pointer 974daaf04c Add "user_is_author" to a story's json 2023-11-15 13:24:33 +00:00
Joan Nyambura 5e60757ebe feature/add-email-visibilty-toggle: Updated email visibility settings and conditions in UI
Added hint for email visibility to logged-in users and adjusted conditions for email display to users who have opted to show their email.
2023-11-08 19:32:13 +03:00
Peter Bhat Harkins d73262d79a match count to stories queried 2023-11-01 16:43:32 -05:00
Peter Bhat Harkins 11bad8f847
Merge pull request #1204 from thiagofportella/master
Display unsave link for previously saved stories
2023-11-01 10:34:13 -05:00
Joan Nyambura c8692b1ea8 Remove unnecessary conditional and schema changes 2023-10-24 11:22:14 +03:00
Peter Bhat Harkins 169c7ea80e
Merge pull request #1214 from JuanVqz/fix-comment-failing-test
Fix comment failing test
2023-10-12 07:11:46 -05:00
Juan Vasquez 642d888ec8 Fix comment failing test
This is the error I'm seeing [in the latest commit](5338e5a4b3)

Seems to be related to a MySQL flag `sql_mode=only_full_group_by` enabled by default.

```ruby
(byebug) Comment.where(user: user).group(:thread_id).order("id desc").limit(20).pluck(:thread_id)
*** ActiveRecord::StatementInvalid Exception: Mysql2::Error:
Expression #1 of ORDER BY clause is not in GROUP BY clause and
contains nonaggregated column 'lobsters_test.comments.id' which is not
functionally dependent on columns in GROUP BY clause;
this is incompatible with sql_mode=only_full_group_by

nil
```

I don't think is a good idea disabling that flag, so, I just updated the query.

Old query
```ruby
(byebug) Comment.where(user: user).group(:thread_id).order("id desc").limit(20)

(byebug) Comment.where(user: user).group(:thread_id).order("id desc").limit(20).to_sql
"SELECT `comments`.* FROM `comments` WHERE `comments`.`user_id` = 1 GROUP BY `comments`.`thread_id` ORDER BY id desc LIMIT 20"
```

New query
```ruby
(byebug) Comment.where(user: user).select(:thread_id).order("id desc").limit(20)

(byebug) Comment.where(user: user).select(:thread_id).order("id desc").limit(20).to_sql
"SELECT `comments`.`thread_id` FROM `comments` WHERE `comments`.`user_id` = 1 ORDER BY id desc LIMIT 20"

(byebug) Comment.where(user: user).select(:thread_id).order("id desc").limit(20).pluck(:thread_id)
[1]
```

```mysql
mysql> explain SELECT DISTINCT `comments`.* FROM `comments` WHERE `comments`.`user_id` = 1 ORDER BY `comments`.`thread_id` DESC LIMIT 20;
+----+-------------+----------+------------+------+---------------------------+---------------------------+---------+-------+------+----------+----------------+
| id | select_type | table    | partitions | type | possible_keys             | key                       | key_len | ref   | rows | filtered | Extra          |
+----+-------------+----------+------------+------+---------------------------+---------------------------+---------+-------+------+----------+----------------+
|  1 | SIMPLE      | comments | NULL       | ref  | index_comments_on_user_id | index_comments_on_user_id | 8       | const |    1 |   100.00 | Using filesort |
+----+-------------+----------+------------+------+---------------------------+---------------------------+---------+-------+------+----------+----------------+
1 row in set, 1 warning (0.01 sec)

mysql> explain SELECT comments.* FROM comments WHERE comments.user_id = 1 GROUP BY comments.thread_id ORDER BY comments.thread_id DESC LIMIT 20;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'lobsters_dev.comments.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
```

Links:
  * https://stackoverflow.com/questions/41887460/select-list-is-not-in-group-by-clause-and-contains-nonaggregated-column-inc
  * https://stackoverflow.com/questions/54547279/mysql-contains-nonaggregated-column-error-when-using-group-rails-5-2
  * https://gitlab.com/gitlab-org/gitlab-foss/-/issues/48428
2023-10-11 22:53:55 -06:00
thiagofportella 36bf8c38b7
test: create new memoized helpers for validation of save and unsave links in deleted stories 2023-10-09 11:22:07 -03:00
Peter Bhat Harkins 3c22b187bf revert cookie change for csrf issue 2023-10-07 07:18:10 -05:00
Peter Bhat Harkins d13c6c4676 comments: fewer db round trips on creation
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.
2023-10-06 23:32:31 -05:00