Commit graph

701 commits

Author SHA1 Message Date
Ben Halpern
8d40f54a31
Add initial functionality for Stackbit on integrations settings tab (#4113)
* Add initial functionality for Stackbit on integrations settings tab

* Add test for stackbit integration

* Adjust test

* switch check from grants to tokens
2019-09-26 07:29:28 -04:00
Anna Buianova
fd1b9868a2 Destroy webhook endpoints when user revokes oaurh app access (#4099)
* Destroy webhook endpoints when user revokes oaurh app access

* Make webhooks destroy on revoke asynchronous
2019-09-26 06:23:38 -04:00
Mac Siri
b7e254ac01
Fix biller spec's zonebie issue (#4112) [ci skip] 2019-09-25 19:00:53 -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
Anna Buianova
9778ada44a Doorkeeper default scope (#4066)
* Start with the doorkeeper scopes

* Added read_articles scope

* Proper doorkeeper authorization for the API articles#me
2019-09-24 11:11:12 -07: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
cyrillefr
70631ad2f7 Listings creation and update API (#4014)
* Listings creation and update API

  - new listings controller
  - refactored code to share core functionnality between api and web controllers
  - code in common in classified listing concerns
  - added tests for index/create/update
  - json output as views
  - updated a factory

* Listings creation and update API: code update

  - refactored json calls
  - added test cases
  - added pagination for list of listings
  - refactored jbuilder files
  - typos

* Listings creation and update API: code update

  - tags and tag_list in controller
  - changed view to display both
  - refactored and added test

* Listings creation and update API: code update

  - small change to resolve conflit

* Listings creation and update API: code update

  - added test case
  - deleted unneeded test case
2019-09-24 07:03:52 -07:00
Mac Siri
465a676d75 Adjust BufferUpdatesController's authorization (#4070)
* Add back validation and add test

* Move article_admin?

* Adjust Buffer policy

* Create buffer_update_policy_spec
2019-09-20 11:50:34 -07:00
rhymes
de6129b29c Replace ^ and $ with \A and \z in Ruby regexps (#4072) 2019-09-20 10:28:34 -04:00
John Curcio
c5cb61f932 Move Reaction.create delay calls to ActiveJob (#3136) (#4022) 2019-09-20 10:19:07 -04:00
Ben Halpern
b1b408e61c
Add more variation to home feed (#4069)
* Add more variance to home feed

* Fix array typo

* Fix up watercooler spec

* Fix up blackbox spec
2019-09-19 12:58:11 -07:00
Jess Lee
ff135c7839 Give interns access to internal articles (#4016)
* add intern role and update policies

* update admin policy spec for rubocop

* add article poolicy spec

* fix spec

* switch to scoped admin role

* Finalize single resource admin

* Adjust buffer permissions
2019-09-19 11:35:49 -07:00
John Curcio
4eabc652a2 Add no-readme option to GitHub tag (#4054) 2019-09-19 13:16:19 -04:00
Anna Buianova
c07eb8d9cd Define Doorkeeper::Application association (#4065) [ci skip] 2019-09-19 10:28:55 -04:00
Mac Siri
e6e57c8835 Fix mention's inconsistent hyperlink (#4051)
* Upgrade mention parsing logic

* Avoid hardcoded link in spec
2019-09-18 14:15:06 -07:00
Anna Buianova
0a16bf934a Added association between webhook_endpoints and oauth apps (#4060)
* Added association between webhook_endpoints and oauth apps

* Limit webhooks access by oauth_app_id when authorized by doorkeeper

* Use rails route helpers in webhooks api test
2019-09-18 13:25:40 -07:00
Oleksii Filonenko
8d9bad372b Move index.delay.delete_object calls to ActiveJob (#4028)
* Move index.delay.delete_object calls to ActiveJob

* Rename {Algolia,Search}::RemoveFromIndexJob

* Update queue_as for Search::RemoveFromIndexJob
2019-09-17 14:10:38 -07:00
Anna Buianova
ce93c436a7 Implement API endpoint for user's webhooks (#4013) 2019-09-17 13:24:44 -04: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
Mac Siri
64f70fff8f
Use build_stubbed in Policy specs (#4017) [ci skip] 2019-09-13 11:38:58 -04:00
Ben Halpern
4076a74cdf
Disallow banned users from updating profile, add noindex to page (#4018)
* Disallow banned users from updating profile, add noindex to page

* Fix user profile tests
2019-09-12 19:24:57 -07:00
Mac Siri
5fba3bd4b9
Improve test speed (#3957) [ci skip] 2019-09-12 16:17:20 -04:00
Ben Halpern
d9634150d8
Add new mod links and tooling (#4009)
* Add new mod links and tooling

* Adjust mod page copy, test
2019-09-12 00:11:01 -04: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
Jacob Herrington
59e7c104f2 Remove commented code and tests (#3989) [ci skip] 2019-09-09 14:51:02 -04:00
John Curcio
1a8132f892 Fix encoding of special characters on organization page rendering (#3944) 2019-09-09 14:13:23 -04:00
Andy Zhao
c9a116db42 Fix edge case for rewarding when unpublished (#3987) 2019-09-09 12:33:50 -04:00
rhymes
b6c27f34fa Use a sortable unique ID for the event_id (#3972) 2019-09-09 10:15:12 -04:00
Mac Siri
14263b287d
Make markdown's mention work with italic (#3868) 2019-09-09 09:23:06 -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
rhymes
f7d6874956 Paginate notifications (#3948)
* Use offset instead of page and explain things

* Make load more button work

* Add tests for admin view

* Restore the previous logged out behavior

* Modernize initNotifications.js

* Revert "Modernize initNotifications.js"

This reverts commit 4a112b797d7911c4ab63ad0c0a07111b4e7abe25.

* Fix elements presence errors

* Change load-more-button to only appear if 7 or more posts (and some notification copy adjustments)
2019-09-07 11:54:30 -04:00
Andy Zhao
8a4030c25d Revert changes as a hotfix (#3964) 2019-09-06 11:54:35 -04:00
rhymes
69c8b24c34 Send JSON 404 response to API error routes (#3959)
* Fix an issue where API 404 calls got the HTML 404 page in response

* Use keyword for consistency
2019-09-06 10:18:50 -04:00
rhymes
2e5a847ab8 API: /api/articles/me defaults to published articles (#3937)
* /api/articles/me defaults to published articles

We want to make it explicit to retrieve unpublished articles, this change defaults `/api/articles/me` to only published articles, also adds `/api/articles/me/published`, `/api/articles/me/unpublished` and `/api/articles/me/all` to make requests more explicit.

* Refactor /me logic into a case switch
2019-09-04 14:02:13 -04:00
Andy Zhao
e25d2eaec9 Escape raw tags in codeblocks properly (#3790) 2019-09-04 08:33:46 -04:00
not-a-patch
6b7d45baed Update article specs to include missing dependent: :destroy (#3873) [ci skip] 2019-09-03 17:38:13 -04:00
rhymes
676cf002bd Webhooks: API fixes and docs (#3901)
* Fix webhook API and add POST /api/webhooks docs

* Document GET /api/webhooks/:id

* Fix DELETE /api/webhooks/{id} and document it

* Add proper 404 specs
2019-09-03 10:41:23 -04:00
Mac Siri
5e75bf3aaa
Update PingAdmins to show triggering event (#3853) 2019-09-03 10:23:25 -04:00
Jacob Herrington
07944755ff Fix rubocop lints (#3922) [ci skip] 2019-09-03 10:09:48 -04:00
rhymes
77e34a726d Fix flaky listings specs (#3899)
* Fix flaky listings specs

* Fix another flaky test
2019-09-02 13:23:41 -04:00
Mario See
fda048dc12 Listing Drafts and Deletion (#3540)
* wip init handle draft class and styling

* add draft button

* start splitting up listing row into multile files

* separate tag links

* split location

* fix location

* separate listing row action buttons

* update listing row proptypes to describe listing object

* contact via connect to jsx

* fix default checked

* init draft creation and first publish charge

* fix first publish logic and credit charging

* handle drafts in dashboard filtering

* adjust isDraft bool statement

* hide drafts from main listings feed

* fix expired and draft bools in listing row

* adjust create listing org credits

* internally handle drafts

* adjust listing row

* break down update method

* remove unnecessary logic and shorten lines

* fix logic again woops

* convert input hidden value + submit into one form button submit with corresponding name and value

also adds clear message that drafts do not cost credits

* handle insufficient org credits on first publish

- uses user credits to publish
- similar to bump implementation

* fix sorting for personal and all orgs

* space out some elements

* don't spend original users credit for them

* add delete buttons and delete_confirm and destroy methods

* remove notification removal since listings dont trigger notifications

* move draft message and add draft_params to tests

* Update classified_listings_controller.rb

* update tests

* update snapshot

* add del tests

* add guard preventing free draft publish

* fix draft filter

* update from master and resolve merge conflict in listing preact

* Revert "update from master and resolve merge conflict in listing preact"

This reverts commit 0a34fccf334a2ca0902644b486cb26ead6bef664.

* update column spec

instead of setting and saving

* separate two expectations into their own tests

* split more tests into single expectations

* change to unless bumped_at? instead of if nil

* Fix listing draft edge cases and styling

* Add title tags to listings pages
2019-09-01 13:54:54 -04:00
Michael Tharrington
5cdd3e2f10 Update Email Copy for internal/reports (#3867) 2019-08-30 09:58:30 -04:00
Jean-Michel Fayard
4af02c8a48 Support for runnable kotlin snippets #3776 (#3801) 2019-08-29 16:06:17 -04:00
Anna Buianova
bfdf636dcf Implement webhook & API endpoints #3715 (#3783) 2019-08-29 10:23:41 -04:00
Ben Halpern
67a8dbcd04
Add hashtags to linkedin body (#3866) 2019-08-28 14:49:31 -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
John Curcio
0f2ae535c8 Removes temp .received file (#3731) (#3821) 2019-08-25 12:30:27 -04:00
Ben Halpern
3443fdf2bd
Create endpoint for liquid tag embed (#3813) 2019-08-23 17:42:04 -04:00