Commit Graph

73 Commits

Author SHA1 Message Date
Sam
5f64fd0a21 DEV: remove exec_sql and replace with mini_sql
Introduce new patterns for direct sql that are safe and fast.

MiniSql is not prone to memory bloat that can happen with direct PG usage.
It also has an extremely fast materializer and very a convenient API

- DB.exec(sql, *params) => runs sql returns row count
- DB.query(sql, *params) => runs sql returns usable objects (not a hash)
- DB.query_hash(sql, *params) => runs sql returns an array of hashes
- DB.query_single(sql, *params) => runs sql and returns a flat one dimensional array
- DB.build(sql) => returns a sql builder

See more at: https://github.com/discourse/mini_sql
2018-06-19 16:13:36 +10:00
45850a0cd6 FIX: don't break when posting invalid URIs 2018-04-19 12:29:35 +02:00
142571bba0 Remove use of rescue nil.
* `rescue nil` is a really bad pattern to use in our code base.
  We should rescue errors that we expect the code to throw and
  not rescue everything because we're unsure of what errors the
  code would throw. This would reduce the amount of pain we face
  when debugging why something isn't working as expexted. I've
  been bitten countless of times by errors being swallowed as a
  result during debugging sessions.
2018-04-02 13:52:51 +08:00
226ace1643 Update annotations. 2018-02-20 14:28:58 +08:00
7f69362d9d FIX: external links in whisper ended up in a white page
FIX: clicking a link in a onebox wasn't properly extracting the post_id
2017-12-20 17:55:15 +01:00
daeb7694bc update annotations 2017-12-05 21:03:20 +05:30
1cae875146 FIX: topic link extraction shouldn't fail when the parsed URL has no path 2017-10-19 15:26:37 +02:00
23b787e0a6 Require dependency otherwise it causes Sidekiq to lock up in development. 2017-09-25 13:48:59 +08:00
77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
66f2925348 SECURITY: do not include links from whispers in topic summary map
https://meta.discourse.org/t/staff-whispers-links-in-whispers-showing-up-publicly-in-topics-summary/69134?u=techapj
2017-08-31 23:44:54 +05:30
b00747fd49 FIX: do not create topic link reflection for unlisted topics 2017-08-22 14:28:01 +05:30
Sam
c68999e128 annotate models
WARNING annotators out there, be to run bin/annotate on RAILS_ENV=test on a clean db
2017-08-16 10:38:11 -04:00
5d528f0d15 Merge pull request #4958 from dmacjam/search_posts_by_filetype
FEATURE: Search posts by filetype
2017-07-31 11:55:34 -04:00
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
d8c27e3871 Merge branch 'master' into search_posts_by_filetype 2017-07-25 14:41:20 -04:00
bc9270defb filetype comparison needs to be case insensitive 2017-07-22 13:18:15 -07:00
3882722195 FEATURE: Inline (Mini) Oneboxing
see:
https://meta.discourse.org/t/mini-inline-onebox-support-rfc/66400?source_topic_id=66066
2017-07-20 15:38:04 -04:00
610728a70f FIX: Don't include images in the topic map top links 2017-07-14 16:37:41 -04:00
f0a674d620 Add extraction of upload extension. Add rspec test for search of post
with upload by extension.
2017-07-06 19:16:07 +02:00
eaf46431d4 Add extraction of file extension in TopicLink and related rspec tests. 2017-06-19 17:09:54 +02:00
453d149182 just checking for existence is enough here 2016-11-30 23:41:07 +01:00
57d0369894 FIX: don't raise an exception when a link was already extracted 2016-11-30 18:05:59 +01:00
Sam
c1a01b2a28 PERF: limit maximum number of topic links to 50
When a giant topic has huge numbers of links only show top 50
if expanded from the show more links... button.
2016-07-19 10:55:35 +10:00
bf64280661 FIX: Incorrect scope when checking for existing topic link. 2016-06-15 14:13:30 +08:00
c13cbc8aea FIX: only show topic links from active users 2016-06-13 11:11:25 +02:00
191d2283f4 Fix specs. 2016-06-13 14:31:10 +08:00
1fe499e893 FIX: Don't include reflections when checking for duplication topic links. 2016-06-13 13:14:35 +08:00
8c3e63f87a Raise an error if create fails. 2016-06-13 13:14:35 +08:00
Sam
9e75b14535 update is not really needed 2016-06-10 17:25:59 +10:00
Sam
65f466cf8c FIX: topic link reflections deleted on second save 2016-06-10 17:25:59 +10:00
df368ce251 FIX: Don't notify of duplicate links on edit of the first post 2016-06-09 13:03:06 -04:00
9a81115c1c FIX: Duplicate link shouldn't happen on edit 2016-06-08 17:22:23 -04:00
e38f17524b FIX: Reflected links weren't being cleaned up properly 2016-06-08 16:09:01 -04:00
2169b1ecbc FIX: Duplicate link message should link to the post 2016-06-08 12:35:11 -04:00
431179dd25 FEATURE: Prompt users when they are entering duplicate links 2016-06-07 14:47:22 -04:00
f382897952 FIX: don't extract link with 'mailto' scheme 2016-04-05 00:43:11 +02:00
9ca9fe729a FIX: internal links in subfolder installs
https://meta.discourse.org/t/links-arent-showing-in-the-sidebar-or-topic-summaries-on-subfolder-installs/41787/15
2016-04-04 01:40:44 +03:00
Sam
32c681c96b annotate models 2016-02-23 10:33:53 +11:00
43c7320f55 FIX: Allow really long links to work 2015-09-25 14:07:20 -04:00
Sam
c1ecd6f4ce update annotations 2015-09-18 10:41:10 +10:00
4451c8802a FIX: post gutter links are broken when using a subfolder 2015-05-14 14:26:18 -04:00
Sam
414c6d191f FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
6301a43d57 Not initializing variable for looping if unused in loop 2014-08-15 03:24:55 +05:30
Sam
45ca83328d Annotate 2014-07-15 11:29:44 +10:00
Sam
89fc989adb FEATURE: First Quote badge 2014-07-11 14:17:43 +10:00
Sam
9a9ad9bda8 FEATURE: Badge progress
- Refactor model so it stores backfill query
- Implement autobiographer
- Remove sample badge
- Correct featured badges to only include a badge once
2014-07-03 17:29:44 +10:00
Sam
dd8a06187a FIX: Invalid URLs cause post not to save 2014-06-26 11:38:23 +10:00
Sam
b1d5f4440b Annotate models 2014-05-28 12:30:57 +10:00
eb0872c5d4 FIX: Topic archetype check should only happen when the topic exists 2014-05-11 15:53:57 -04:00
2bb63ffb38 FIX: Don't show links to private messages in the gutter 2014-05-11 15:16:28 -04:00