Commit graph

357 commits

Author SHA1 Message Date
Andy Zhao
d08f830d86
Add response templates model and table (#6615)
* Add response templates model and table

* Add missing factory oops

* Remove response templates on delete

* Remove moderator_id column from comments for now

* Use constants and add spec for response templates
2020-03-16 09:52:03 +07:00
rhymes
86129395eb
Cleanup tag validation a bit (#6604)
* Cleanup tag validation a bit

* Use symbols
2020-03-12 15:41:08 +01:00
Vaidehi Joshi
502bef156e
Allow an article's main_image to be removed (#5687) [deploy]
Currently, we don't allow users to remove the `main_image` of an article once it has been set. It can be changed, but never removed.
This change allows the `main_image` to be removed by checking for the `cover_image` key in the frontmatter that is sent along in the article's markdown. This means that a user should be able to remove the image associated with an article by removing the value of `cover_image:` from their frontmatter.
2020-03-10 08:29:59 -07:00
Ben Halpern
0817e2ac9e
Create implicit experience level rating vote upon creating of readinglist reaction (#6522) [deploy]
* Do not render or link to empty rss feeds

* s

* Move calculation to worker

* remove xit test

* Also allow implicit rating votes in comments

* Fix alignment issue

* Remove comment logic
2020-03-10 10:59:49 -04:00
rhymes
c7503fd0b1
Fix scripts startup check for development mode (#6520)
* Fix scripts startup check for dev mode

* Update doc
2020-03-09 17:15:21 +01:00
Molly Struve
82526989fc
Index Articles and Podcast Episodes to Elasticsearch (#6488) [deploy]
* Index Articles and PodcastEpisodes to Elasticsearch

* add callbacks to podcast episodes and specs

* refactor and clean up serializers
2020-03-06 16:39:36 -05:00
Molly Struve
731b89ca26
Index users into elasticsearch (#6489) [deploy] 2020-03-06 14:12:02 -05:00
Alex
35651b26e5
Remove Algolia from Comments (#6464) [deploy]
* Remove Algolia from comments

* Remove more references to ordered_comments index

* Remove more references to Comments Algolia index

* Fix index_worker_spec
2020-03-05 11:30:25 -08:00
Molly Struve
067cab1689
create searchable specs and remove redundant specs from AR models (#6450) [deploy] 2020-03-04 15:09:53 -05:00
Julianna Tetreault
f6478fb7cc
Replace peform_enqueued_jobs with sidekiq_perform_enqueued_jobs in specs (#6454)
* Replace peform_enqueued_jobs with sidekiq_perform_enqueued_jobs in specs

* Fix typo in reaction_spec
2020-03-04 11:39:48 -07:00
rhymes
f3e76e7fe5
Improve API docs for articles, add listings to it and fix bugs (#6413) [deploy]
* Fix articles index state param values

* Update Articles API docs

* Fix ClassifiedListing.cost_by_category with invalid category

* Add docs for GET|POST /listings and fix bugs

* Document PUT /api/listings/:id

* Add docs for /listings/category/{category}

* One variable down

* Improve listings update error handling
2020-03-04 15:30:02 +01:00
Michael Kohl
4e1ccf4a3a
Add .present? check (#6302) 2020-03-03 09:34:17 -05:00
Andy Zhao
a3728cfa4c
[deploy] Add EmailAuthorization model (#6335)
* Add EmailAuthorization model

* Add model file oops

* Add comment for uuid type

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-03-02 12:14:24 -05:00
Gonzalo Ricco
5d22cdef79
Prevent deadlocks with article-collection updates. (#6371) [deploy]
When an article is updated the associated collection is touched along with all its articles. This creates a deadlock where two transaction(nested) lock the article that was updated.
With this commit the collection wll be touched after the article updates transaction has been commited. Doing so we have two sequential transactions.
2020-03-02 09:38:15 -05:00
Ridhwana
0f9c9d2738
Sanitisation of Ads (#6361) [deploy] 2020-02-28 13:20:34 -05:00
Michael Kohl
32e30c8844
Mailchimp resubscribe (#6256)
* Re-subscribe user to newsletter by setting MC status to pending

* Add guard clause and new spec

* Make trait name more explicit

* Fix guard clause and spec
2020-02-27 15:48:38 -05:00
Alex
037b2fa432
Fix pagination on Search::ChatChannelMembership (#6328) [deploy]
* Fix pagination logic

* Fix typo slig --> slug

* Add spec for returning empty Array vs nil

* Add spec for pagination

* Change expectation of test for empty Array
2020-02-27 09:56:05 -08:00
rhymes
2fcdb9bcaa
Use DataUpdateScript.scripts_to_run? in development (#6309) 2020-02-26 13:34:16 -05:00
Molly Struve
8f0bfa5e08
Implement Search for Chat Channels with Elasticsearch (#6282) [deploy] 2020-02-26 11:06:38 -05:00
Anna Buianova
057b1c7664
Fix Sponsorship validations to take expiration date into an account (#6276)
* Fix Sponsorship validations to take expiration date into an account

* Use prettier times in sponsorship specs
2020-02-25 16:41:28 -05:00
Alex
da259107bd
Refactor logic to index to Elasticsearch (#6286) [deploy]
* Refactor logic to index to Elasticsearch

* Rename worker argument to object_class

* Change to .constantize for better error messaging
2020-02-25 11:06:42 -08:00
Spencer
010c61a44a
Allow comments without a commentable to be edited and destroyed (#5945) 2020-02-25 13:45:50 -05:00
rhymes
33a11adca8
Various optimizations (#6249) [deploy]
* Pluck over map
* Explain why map makes sense there
* Refactor reactions controller a bit and iterate only once
* Use group by instead of N counting queries
* More positive
* Simplify BufferedArticlesController
* Less queries for MailchimpBot
* Use Rails instead of SQL
* Build comment_ids only when needed
2020-02-25 13:42:24 -05:00
rhymes
cf11268949
Add logging to data scripts runner (#6201) 2020-02-25 13:41:43 -05:00
Gonzalo Ricco
0b03240e5b
Add rescue InvalidURIError in mastodon_url validation (#6174) [deploy] 2020-02-24 19:13:40 -05:00
Matej Minárik
89dd843a50
Fix Flaky Comment Spec (#6250) 2020-02-24 18:48:45 -05:00
rhymes
168f5c597c
Bump Twitter to 7.0 and refactor TwitterBot (#6246) [deploy] 2020-02-24 08:34:41 -05:00
Molly Struve
318ee32cdd
Add worker for removing Elasticsearch docs (#6213) [deploy] 2020-02-21 08:13:36 -05:00
rhymes
bc385ae6d5
Switch decorators to Rails builtin decorations - take 2 (#6125) [deploy]
* Revert "Revert "[deploy] Switch decorators from Draper to Rails builtin decorations (#6040)" (#6122) [deploy]"

This reverts commit d438349550.

* Enable serialization for decorators

* Refactor and test default home feed serialization

* Improve spec

* Applied @vaidehijoshi suggestions

* Applied @citizen428 suggestions

* Make CodeClimate happy

* Cleanup stories_index_spec.rb

* Refactor UserDecorator#cached_followed_tags to loop less
2020-02-19 15:30:53 -05:00
Molly Struve
e752ff98af
Index ChatChannelMemberships to Elasticsearch (#6162) [deploy] 2020-02-19 14:29:16 -05:00
Juan Vasquez
c50c59c250
Prevent save on invalid canonical url (#6093) [deploy] 2020-02-19 13:55:27 -05:00
Alex
8d7b95ea15
Index ClassifiedListings to Elasticsearch (#6132) [deploy]
* Add ClassifiedListingEsIndexWorker & spec

* Update ClassifiedListing model

- Add es index methods (inline and async)
- Index ClassifiedListing to es after_commit
- Add serialized_search_hash
- Update model specs for new methods
- Add serializers referenced in new model method

* Update specs

* Create DataUpdateScript to index ClassifiedListings

* Fix formatting

* Fix codeclimate :/

* Use match_array instead of keys.sort

* Change find_by! to find

* Update spec

* Update mappings for ClassifiedListing

* Update specs

* Implement refactor with Searchable module
2020-02-19 09:55:37 -05:00
Molly Struve
4203b57944
rescue Psych::DisallowedClass when parsing frontmatter (#6145) [deploy] 2020-02-19 08:31:04 -05:00
Molly Struve
06b44bce26
Refactor Common Search Methods into a Base Class (#6133) [deploy] 2020-02-18 10:43:47 -05:00
Molly Struve
98f25e2b9d
Remove UserHistory Feature and PageViews from Algolia (#6127) [deploy] 2020-02-18 10:06:30 -05:00
rhymes
d438349550
Revert "[deploy] Switch decorators from Draper to Rails builtin decorations (#6040)" (#6122) [deploy]
This reverts commit cc53b55a4a.
2020-02-17 11:28:32 -05:00
rhymes
cc53b55a4a
[deploy] Switch decorators from Draper to Rails builtin decorations (#6040)
* Convert SponsorshipDecorator to Rails decorator

* Remove empty ReactionDecorator

* Rename SponsorshipDecorator#level_color_hex to level_background_color

* Convert CommentDecorator to Rails decorator

* Add specs and fix bugs for NotificationDecorator

* Convert NotificationDecorator to Rails decorator

* Add specs and fix bugs for OrganizationDecorator

* Convert OrganizationDecorator to Rails decorator

* Add specs to PodcastEpisodeDecorator and fix bugs

* Convert PodcastEpisodeDecorator to a Rails decorator

* Add missing specs for ArticleDecorator and fix bugs

* Convert ArticleDecorator to Rails decorator

* Add missing specs to UserDecorator and fix issues

* Convert UserDecorator to Rails decorator

* Add .decorate_collection method

* Add decorator for AR relations and remove Draper

* Rename BaseDecorator back to ApplicationDecorator

* Rename .decorate_ back to .decorate

* Restore decorate_collection (WTH)

* Add decorated?

* Fix bugs and failing specs

* Decoration should always be explicit
2020-02-17 09:32:32 -05:00
Molly Struve
65eba740ab
Document DataUpdateScripts, Add to Deploy Process, Add Development Check (#6068) [deploy] 2020-02-14 11:45:27 -05:00
Molly Struve
0bfbd9bb1f
Set Up Framework For Running Data Update Scripts (#6025) [deploy] 2020-02-13 10:48:23 -05:00
Lucas Hiago
f68bd8bc4f
Change UpdateReactableJob to UpdateReactableWorker and move to sidekiq (#5551) [deploy] 2020-02-13 10:13:11 -05:00
Lucas Hiago
d0b4ba2648
Change BustReactableCacheJob to BustReactableCacheWorker and move to sidekiq (#5582) [deploy] 2020-02-12 11:50:40 -05:00
Molly Struve
3fed9338d2
Index Tags to Elasticsearch after they are created (#5958) [deploy]
* Index tags to Elasticsearch after they are created
* add rules_html to Tag index since we show it in search drop down
* change get method to find_document to make it more explicit
2020-02-11 11:58:58 -05:00
Mohamed ABDELLANI
faad0b83e6
Handle Reactions Without Users When Sending Notifications (#5820)
* Add reaction's owner existence in the database

* Add test
2020-02-07 14:10:52 -05:00
Maykon Menezes
58b96f104e
create Users::EstimateDefaultLanguageWorker for Sidekiq (#5697) [deploy] 2020-02-07 13:49:02 -05:00
Ben Halpern
f3c86c6377
Add mod channel automation to tags (#5731) [deploy]
* Add mod channel automation to tags

* Change mod_relations to mod_relations_admin

* Run migration properly

* Make queries consistent and fix test
2020-02-06 16:27:12 -05:00
codekatas
bae7ee8b73
Migrate update main image background job to sidekiq (#5345) [deploy]
* Add new UpdateMainImageBackgroundHexWorker worker class

This is a port of app/jobs/update_main_image_background_job.rb
that works with Sidekiq instead of DelayedJob.

* Update all references to UpdateMainImageBackgroundHexJob

This updates all references to UpdateMainImageBackgroundHexJob
so they now call UpdateMainImageBackgroundHexWorker, which works
with Sidekiq instead of DelayedJob.

* Move method call to after_commit callback

* Fix article specs with sidekiq helpers

Co-authored-by: Alex <alexandersmith223@gmail.com>
2020-02-04 17:51:09 -08:00
Alex
67894aa1f8
Move Articles::DetectHumanLanguage from background job to inline (#5888) [deploy]
* Move DetectHumanLanguage inline

* Remove old DetectHumanLanguage job and spec

* Fix copy/pasta mixup...oopsie!

* Update article_spec for inline LanguageDetector
2020-02-04 10:45:42 -08:00
Alex
8168a5e8f5
Move Articles::ScoreCalcJob to Sidekiq (#5875) [deploy]
* Create Articles::ScoreCalcWorker

* Create Articles::ScoreCalcWorker spec

* Update references to the new ScoreCalcWorker

* Refactoring conditional callbacks and biz logic

- Move update_columns to a model method
- Move conditions on callback to guard clause in callback method
- Make article_destroy_spec more explicit
2020-02-04 10:01:46 -08:00
Alex
0c42ea2b43
Move Tags::BustCacheJob to Sidekiq (#5870) [deploy]
* Create Tags::BustCacheWorker

* Create Tags::BustCacheWorker spec

* Update references to new worker
2020-02-04 09:24:37 -08:00
rhymes
a1835ae5b9
User counters using PostgreSQL JSON (#5373) [deploy]
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-02-03 10:35:08 -05:00