Commit Graph

84 Commits

Author SHA1 Message Date
Robin Ward 95f263995d FIX: Previous annotations were broken 2019-01-11 14:30:19 -05:00
Robin Ward a3839495e0 Update annotations 2019-01-11 12:19:43 -05:00
Arpit Jalan d1597683f3 Revert "FIX: trim trailing slash from topic links"
This reverts commit 993f847a2c.

There is an edge case where the link click redirect fails when the URL has trailing slash. Need to figure out a better fix for this.
2019-01-03 17:29:22 +05:30
Arpit Jalan 993f847a2c FIX: trim trailing slash from topic links 2019-01-03 12:38:36 +05:30
Sam 671469bcc7 FIX: URLs containing two # would fail to work
Some URLs in browsers are non compliant and contain twos `#` this commit adds
special handling for this edge case by auto encoding any fragments containing `#`
2018-12-11 18:03:13 +11:00
David Taylor a1d9aeda8b REFACTOR: split `TopicLink#extract_from` into multiple methods
Also rename some confusing variables
2018-12-05 18:54:30 +01:00
David Taylor 37249c9a32 FIX: Do not reset link counts when post is rebaked
This was an indentation mistake introduced in 44eba0b. Pretty understandable, considering we are indented 8 levels deep in this method. Will follow-up with a refactor to improve this.
2018-12-05 18:54:30 +01:00
Guo Xiang Tan 44eba0bb60 FIX: Don't rescue `PG::UniqueViolation` within a transaction.
Also acquire a transaction per link instead of failing when
any of the links can't be processed.

This prevents ActiveRecord from rolling back the transaction
and the next SQL statement sent to PG will fail. This is
however hard to test as it only happens when there are
two competing process trying to process this method at the
same time.
2018-10-18 10:54:30 +08:00
Régis Hanol de92913bf4 FIX: store the topic links using the cooked upload url 2018-08-14 12:23:32 +02:00
Régis Hanol bf4d98e89d FIX: always store topic links using the upload url 2018-08-04 01:29:32 +02:00
Arpit Jalan 7da22e395b FIX: do not show links with 0 click on topic map 2018-07-18 10:50:01 +05:30
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
Régis Hanol 45850a0cd6 FIX: don't break when posting invalid URIs 2018-04-19 12:29:35 +02:00
Guo Xiang Tan 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
Guo Xiang Tan 226ace1643 Update annotations. 2018-02-20 14:28:58 +08:00
Régis Hanol 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
Arpit Jalan daeb7694bc update annotations 2017-12-05 21:03:20 +05:30
Gerhard Schlager 1cae875146 FIX: topic link extraction shouldn't fail when the parsed URL has no path 2017-10-19 15:26:37 +02:00
Guo Xiang Tan 23b787e0a6 Require dependency otherwise it causes Sidekiq to lock up in development. 2017-09-25 13:48:59 +08:00
Guo Xiang Tan 77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Arpit Jalan 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
Arpit Jalan 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
Neil Lalonde 5d528f0d15 Merge pull request #4958 from dmacjam/search_posts_by_filetype
FEATURE: Search posts by filetype
2017-07-31 11:55:34 -04:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Neil Lalonde d8c27e3871 Merge branch 'master' into search_posts_by_filetype 2017-07-25 14:41:20 -04:00
Jeff Atwood bc9270defb filetype comparison needs to be case insensitive 2017-07-22 13:18:15 -07:00
Robin Ward 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
Robin Ward 610728a70f FIX: Don't include images in the topic map top links 2017-07-14 16:37:41 -04:00
Jakub Macina 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
Jakub Macina eaf46431d4 Add extraction of file extension in TopicLink and related rspec tests. 2017-06-19 17:09:54 +02:00
Régis Hanol 453d149182 just checking for existence is enough here 2016-11-30 23:41:07 +01:00
Régis Hanol 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
Guo Xiang Tan bf64280661
FIX: Incorrect scope when checking for existing topic link. 2016-06-15 14:13:30 +08:00
Régis Hanol c13cbc8aea FIX: only show topic links from active users 2016-06-13 11:11:25 +02:00
Guo Xiang Tan 191d2283f4
Fix specs. 2016-06-13 14:31:10 +08:00
Guo Xiang Tan 1fe499e893
FIX: Don't include reflections when checking for duplication topic links. 2016-06-13 13:14:35 +08:00
Guo Xiang Tan 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
Robin Ward df368ce251 FIX: Don't notify of duplicate links on edit of the first post 2016-06-09 13:03:06 -04:00
Robin Ward 9a81115c1c FIX: Duplicate link shouldn't happen on edit 2016-06-08 17:22:23 -04:00
Robin Ward e38f17524b FIX: Reflected links weren't being cleaned up properly 2016-06-08 16:09:01 -04:00
Robin Ward 2169b1ecbc FIX: Duplicate link message should link to the post 2016-06-08 12:35:11 -04:00
Robin Ward 431179dd25 FEATURE: Prompt users when they are entering duplicate links 2016-06-07 14:47:22 -04:00
Régis Hanol f382897952 FIX: don't extract link with 'mailto' scheme 2016-04-05 00:43:11 +02:00
Nick Ivanter 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
Robin Ward 43c7320f55 FIX: Allow really long links to work 2015-09-25 14:07:20 -04:00