Commit graph

214 commits

Author SHA1 Message Date
aRtoo
05cfe16e1c Fix comment author being notified when mentioning itself (#4456)
* added a condition to check if owner of the comment is in mentions

* added a test to check if comment owner can mention self

* fixed metion test by:
  - adding a second user to simulate a owner of a comment
  - change the user on comment to owned by newly created user
2019-10-25 10:23:45 -04:00
Fabbri Paolo
89e893f157 Fix rubocop detected offenses (#4552)
* Run Inspecting 1050 files
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.....................................................................................................................................................................................................................................................................................................

Offenses:

spec/models/article_spec.rb:195:7: C: RSpec/NestedGroups: Maximum example group nesting exceeded [4/3]. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups)
      context "when description is empty" do
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1050 files inspected, 1 offense detected to fix autofixable errors

* Refactor  to correct test

it was braking the rule RSpec/NestedGroups: Maximum example group nesting exceeded [4/3]. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups)

* Run `rubocop --auto-gen-config` to regenrate `.rubocop_todo.yml`
2019-10-24 11:53:03 -04:00
Aleksandr
80316818d5 Fix state=all 500 error bug (#4525) [ci skip] 2019-10-23 17:19:47 -04:00
Andy Zhao
73caa9a864 New Feature: Block Users (#4411)
* Prevent need for eager loading

* Add initial implementation of user block

* Remove debugger oops

* Add index and foreign keys for user_block table

* Use private method instead of exists

* Move channel handling logic to service object

* Update styling a bit

* Use profileDropdown file for future proofing

* Remove commented out code

* Render json: { result } for all endpoints

* Add statuses for sad paths

* Add better sad path handling in the JS

* Remove accidentally committed spec file

* Don't wait for DOM to load block button

* Use equality for accuracy in slug query

* Add status code for unauthorized requests

* Add missing comma sigh
2019-10-23 17:14:28 -04:00
Branko Arnaudovski
efbb108061 Implement Moderators audit logs (#3449) 2019-10-23 10:30:45 -04:00
Nadiya Karachevska
4dad407289 API: Add pagination to articles (#4483)
* Add pagination to articles

* Refactoring

* Update specs
2019-10-22 12:41:00 -04:00
Anna Buianova
41ba46623c Increase redirects limit when fetching podcasts (#4479) 2019-10-17 11:24:29 -04:00
Araslanov Evgeny
60d8a07276 Fix invalid body_markdown in article with video (#4258) [ci skip] 2019-10-08 15:41:44 -04:00
Anna Buianova
cbfe53e81b Rescue SocketError when trying to fetch a podcast (#4274) [ci skip] 2019-10-07 10:26:22 -04:00
cyrillefr
82cca496fd Add collection ids to Api (reading + filtering) (#4180)
* Add collection ids to Api (reading + filtering)

  - refactored controller
  - modifyied views
  - added tests

* Add collection ids to Api (reading + filtering): requested changes

  - changed order in service
  - proper test in filtering
2019-10-03 11:26:39 -04:00
Allan Klaus
4402cc212c Create tests to PingAdmins (#4169) [ci skip] 2019-10-03 11:18:53 -04:00
Mac Siri
dd391d5e34
Validates Article's published_at (#4140) 2019-10-01 15:57:36 -04:00
Araslanov Evgeny
418e66d5ff Refactoring Notifications::NewComment::Send (#4115) 2019-10-01 10:39:58 -04:00
John Curcio
bfef186684 Fix medium liquid tags scraping (#3485) (#4120)
* Scrape medium tag information using page meta tags (#3485)

* Add tests for medium liquid tag service
2019-10-01 10:29:25 -04:00
Andy Zhao
3b0f6f2834 Refactor remove_all and remove_each notifications and fix orphaned notifications (#3570) 2019-09-25 15:31:56 -04:00
rhymes
c8abbe9d60 Pro: memberships (#3461)
* Add ProMembership model

* Implement ProMembershipsController#create

* Implement basic ProMembershipsController#show

* Add ProMembership to ledger

* Populate user history after pro subscription is created

* Add fields for expiration notifications

* Add ProMemberships::ExpirationNotifier to notify users of expiring memberships

* Add tasks for recurring jobs to notify users of expiration

* Add auto_recharge column to ProMembership

* Add ProMemberships::Biller (incomplete)

* Fix specs

* Add ProMembership to Administrate

* Fix spec

* Add has_enough_credits? to User and Organization

* Add Payments::Customer class

* Finish ProMembership::Biller functionality

* Fix ProMemberships::Creator check for credits

* Disable destroy actions for ProMembershipsController

* Correctly authenticate ProMembershipsController actions

* Make sure only pro user's history can be indexed

* Add ProMembershipsController#update action for auto recharge

* Use regular AR to save new credits and add touch to the purchaser

* Clarify Pro membership create policy

* Display information about an existing pro membership

* Add UI to show page

* Add system test for Pro membership creation

* Implement edit membership

* Make sure users with pro memberships can access history and dashboard pro

* Fix padding issue

* Show a different text for a user that has credits but not enough for Pro

* Move Pro Membership functionality inside settings

* Update Pro Membership link in email notifications

* Bust all relevant caches

* Add the Pro checkmark around the website

* Use Users::ResaveArticlesJob instead of delay

* Add/remove user from pro-members chat channel

* Use the appropriate Pro checkmark

* Remove unfinished pro elements

* Remove checkmark JS
2019-09-24 10:38:54 -07:00
Anna Buianova
78472d1529 Send only public events to the webhook endpoints #3715 (#4046)
* Dispatch an event only when a published article is created

* Skip sending events about drafts updates

* Skip sending events when a draft is destroyed

* Fix article request spec

* Slight refactoring
2019-09-17 08:00:04 -07:00
Anna Buianova
2d04488f4d Dispatch events only to the corresponding user endpoints (#4008)
* Dispatch events only to the corresponding user endpoints

* Specify user for dispatch webhook event test to be sure

* Fix webhooks specs
2019-09-11 15:33:11 -04:00
rhymes
b6c27f34fa Use a sortable unique ID for the event_id (#3972) 2019-09-09 10:15:12 -04:00
Anna Buianova
4c9a40be41 Dispatch events to the webhook endpoints #3715 (#3872)
* Start with webhooks: table and model

* Start with webhooks api

* Start with webhooks api

* Webhook::Event class and events list

* Remove commented callbacks

* Start with sending events to webhook endpoints

* A couple of tests for Articles::Creator

* Send event to webhook endpoint on article destroy

* Dispatch event on article update

* Dispatch event when an article updated from admin

* Spec for the webhook job

* One more test for the dispatch event job

* Integration-like spec for event dispatching to webhook endpoints when creating an article

* Use Addressable::URI to parse endpoint url

* Add oj as a faster fast_jsonapi backend

* Renamed serializers

* Move article serialization out of a model

* Don't allow to create a webhook event with invalid type

* Add fields for ArticleSerializer

* Fix webhook event job specs

* Specify timeout when dispatching events

* Fix webhook job spec

* Change webhook events queue name

* Change serialized article fields for the dispatchable events

* Include user data when serializing an article for webhook event

* Moved decorating out of Webhook::DispatchEvent, fixed most specs

* Fix route in ArticleSerializer

* Move Article decoration to Webhook::PayloadAdapter

* Refactor image url helpers to avoid including helpers into serializer

* Fix specs

* Default url options for production
2019-09-07 13:17:45 -04:00
Mac Siri
5e75bf3aaa
Update PingAdmins to show triggering event (#3853) 2019-09-03 10:23:25 -04:00
Jacob Herrington
099b188530 Rename uncommunicative variables (#3890)
* Clarify uncommunicative variables in labor classes

Single letter variable names are largely a question of preference, in
some cases I think that convention mitigates the opaque nature of single
letter variable names (e.g., e for error, i for index, etc).

However, in some cases they can be unclear and there isn't much reason
to use single letter variables unless for some reason character length is
really important.

In this case, I would prefer clarity in variable names over brevity of
code so I've used Reek to identify short variable names and I'm changing
them.

It's pretty boring, but hopefully incremental code love changes like
this one add up and improve readability and accessibility for those
interested in reading this codebase.

* Remove commented code from 2 years ago

* Clarify uncommunicative naming in services classes

There is some context for this change in 6b81880f

* Clarify uncommunicative naming in models

There is some context for this change in 6b81880f

* Clarify uncommunicative naming in liquid_tags

There is some context for this change in 6b81880f
2019-09-02 13:05:07 -04:00
Ben Halpern
9259a70ab8
Modify onboarding slides (#3864) 2019-08-28 11:05:57 -04:00
Ben Halpern
208bbb3757
Improve mod roundrobin notification and internal tooling (#3855)
* Improve mod roundrobin notification and internal tooling

* Fix tests
2019-08-27 21:54:09 -04:00
cyrillefr
369aeb9130 Fix comment deletion bug (#3732)
Fix bug where deleted comment still appears on user's profile
2019-08-27 17:07:09 -04:00
Anna Buianova
9b04654e3b Refactor articles creation (#3797)
* Refactor articles creation

* Create article from /admin via a service for consistency

* Move articles destroy logic into Articles::Destroyer
2019-08-23 14:43:29 -04:00
Ben Halpern
76bedc6b23
Add onboarding variants and update variant display ratio (#3812) 2019-08-23 12:48:29 -04:00
Ben Halpern
40559a0457
Add random variants to onboarding for a/b testing (#3742)
* Add random variants to onboarding for a/b testing

* revert listings dashboard snapshot
2019-08-18 18:30:22 -04:00
cyrillefr
30828cf0f7 Move delayed calls for update analytics to Active job (#3603)
* Move delayed calls for update analytics to Active job

  - add job + job spec
  - refactoring

* update namings+specs due to requested changes after review

* Fixes on analytics job spec + minor refactor of service
2019-08-16 12:41:37 -04:00
Ben Halpern
d1760c4d08
Fix mention notification to mention proper user (#3721) 2019-08-14 14:43:21 -04:00
Anna Buianova
3b97eb3f9c Rescue all Errno exceptions while fetching a podcast episode (#3689) 2019-08-12 11:57:43 -04:00
Anna Buianova
f9da88b006 Moved send_mention_notification to ActiveJob (#3566) 2019-08-01 16:35:25 -04:00
rhymes
8f5706fcc1 Remove all old membership code, see 97040ab6 (#3575) 2019-07-30 12:33:50 -04:00
dependabot-preview[bot]
653b74b39b Bump feedjira from 2.2.0 to 3.0.0 (#3560)
* Bump feedjira from 2.2.0 to 3.0.0

Bumps [feedjira](https://github.com/feedjira/feedjira) from 2.2.0 to 3.0.0.
- [Release notes](https://github.com/feedjira/feedjira/releases)
- [Changelog](https://github.com/feedjira/feedjira/blob/master/CHANGELOG.md)
- [Commits](https://github.com/feedjira/feedjira/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Update Feedjira's usage of parse
2019-07-30 10:10:56 -04:00
Ben Halpern
710c1d9e7b
Allow for the sending of arbitrary broadcasts (#3569) 2019-07-29 17:10:49 -04:00
Anna Buianova
7c1917f5f7 Don't hide podcasts if they have reachable episodes (#3532)
* Don't hide podcasts if they have reachable episodes
Recheck episodes' reachability after the podcast status is set to
unreachable

* Update db/schema.rb

* Fix GetEpisodesJob specs

* Fix stories spec

* Episodes are reachable even if the podcast is unreachable

* Improve the Podcast.reachable query

* Fix podcasts root page spec

* Add index concurrently
2019-07-26 11:33:31 -04:00
rhymes
1e72749cc0 Remove unnecessary pluck calls (#3534) [ci skip] 2019-07-24 12:01:09 -04:00
Mac Siri
9f6cf61911
Update Banisher (#3495) [ci skip] 2019-07-16 19:08:06 -04:00
Anna Buianova
94ab4e23fe Update podcast episode statuses #2952 (#3450) 2019-07-16 13:36:25 -04:00
Andy Zhao
4da791e5af Cache bust the article's path and add minor improvement for banishing (#3492) 2019-07-16 13:17:29 -04:00
Anna Buianova
135d1ddf2b Don't check url and create podcast episode when there's no enclosure url (#3460)
* Don't check url and create podcast episode when there's no enclosure url

* Keep a couple of records of podcast's rss for test
2019-07-12 12:54:14 -04:00
Anna Buianova
567579daf3 Podcast episodes statuses #2952 (#3386) 2019-07-12 10:03:57 -04:00
rhymes
d5057f7958 Show sponsorships in ledger (#3447) 2019-07-11 16:06:31 -04:00
Mac Siri
28e5ef1d12 Make RSS's self-referential link an option (#3428)
* Create migration

* Run migration

* Update validations

* Add additional form

* Update RssReader::Assembler#thorough_parsing

* Add spec for referential
2019-07-09 17:34:21 -04:00
rhymes
1f97669e66 Credits ledger (#3395)
* Add #purchase to Credit

* Assigns spent credits to the listing

* Add Credits::Ledger and use it

* Localize ledger datetimes

* Add organization to the ledger

* Add tests for ledger

* Remove unused class

* Fix scope error

* Compare UTC times

* Fix broken specs

* Wrap listing create in a transaction

* Wrap listings bump into a transaction

* Avoid microseconds issue with datetimes in tests

* Use .detect instead of .select.first

* Fix spec description
2019-07-09 10:11:18 -04:00
cyrillefr
5146532c82 Move messages send_push delay calls to ActiveJob (#3314) 2019-07-08 18:00:19 -04:00
Anna Buianova
c3ed38f832 Moved creating a new podcast to a separate ActiveJob #2952 (#3373)
* Podcasts reachable status #2952

* Specs for podcasts statuses

* Moved podcast episode create to a separate ActiveJob

* Use RssItemData wrapper in GetEpisode for consistency

* Reorganize services/podcasts
2019-07-04 13:10:54 -04:00
Anna Buianova
3d81753285 Rescue possible SSLError when fetching a podcast (#3374) 2019-07-03 10:36:36 -04:00
Anna Buianova
d6a151703c Podcasts reachable status #2952 (#3341)
* Podcasts reachable status #2952

* Specs for podcasts statuses
2019-07-02 09:18:27 -04:00
Anna Buianova
7ee0350ac5 Refactored and optimized getting existing podcast episode (#3319)
* Refactored and optimized getting existing podcast episode

* Podcast#existing_episode fixes
2019-06-27 11:50:27 -04:00