Commit graph

1905 commits

Author SHA1 Message Date
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
Mac Siri
498b08dbb9
Fix reading time logic (#4049) [ci skip] 2019-09-17 13:17:06 -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
Bolarinwa Balogun
8d4aa8b157 Resolve inconsistent reading time estimate (#3328) 2019-09-16 10:05:07 -04:00
Ben Halpern
1e8954e581
Add iframe resizer content lib (#4019) 2019-09-12 20:14:54 -07: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
Dmitro Pochapsky
d0f615f3af Fix chat.jsx lints (#3889) 2019-09-12 09:30:59 -04:00
Yash Dave
65d706b1d0 Adjust poll's hover css (#4012) [ci skip] 2019-09-12 09:04: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
Mario See
01a60b1ee9 Internal Listings: Filter by Category (#3993)
* add select tag and category param

* change filter from onchange to submit

* change options list to call from set list
2019-09-11 19:27:39 -04:00
Jacob Herrington
b00505e9f4 Replace try with safe navigation operator (#3988) [ci skip] 2019-09-11 16:16:37 -04:00
Rishabh Budhiraja
653a266141 Fix links in badge email (#4006) 2019-09-11 15:55:15 -04:00
Mac Siri
57eeceeb74
Generate doorkeeper's view (#3991) [ci skip] 2019-09-11 15:53:46 -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
Mario See
6be90c9ad4 Internal Listings: Fill Tweet Text (#3992)
* fill tweet with info even if user doesn't have twitter

* shorten twitter username check

access user from listing instead of finding user via id
2019-09-11 10:25:11 -04:00
Ben Halpern
590149fd48
Fix notifications past aggregation query (#3998) 2019-09-10 11:27:23 -04:00
rhymes
80e6cf4801 Notifications: increase efficiency and fix pagination offset issue (#3986)
* Increase efficiency and fix pagination offset issue

Right now we filter recently aggregated notifications at runtime, which worked before when there was no pagination, but now filtering is not a good idea combined with offset pagination because it throws off the calculations.

The filtering should be done in the SQL query before paginating, which is what we've switched to. I added a bunch of scopes to make the code clearer as well.

To avoid nesting tags I've also updated the HTML and the JS logic to insert it in the right place.

* Add explanation for hiding the load more button for new users
2019-09-10 09:43:45 -04:00
Anna Buianova
8d4991f906 Show webhooks list in internal (#3997) 2019-09-10 09:43:21 -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
rhymes
61494d2343 Images uploads: fix UI for multiple images (#3958)
* Fix spacing of images button in editor v1

* Fix wording for multiple images in editor

* Update JS tests
2019-09-07 10:57:14 -04:00
Anna Buianova
5248a781b5 Rescue InvalidURIError when busting cache (#3938) 2019-09-06 13:07:24 -04:00
Andy Zhao
8a4030c25d Revert changes as a hotfix (#3964) 2019-09-06 11:54:35 -04:00
Andy Zhao
aadd376f9c Use explicit email domain for badge email links and minor cleanup (#3943)
* Set domain for badge email links

* Add credits + listings info to plain text badge email

* Update environment variable setting

* Use ENV when ApplicationConfig has not been init
2019-09-06 10:20:48 -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
3a0dc13fc7 Replace "access token" with "API Key" (#3960) [ci skip] 2019-09-06 09:08:39 -04:00
Almenon
1a99e9bf1a Hide scrollbars in the editor textarea (#3897)
* Hide scrollbars

There is no need for scrollbars in the textarea given the scrollbar at the edge of the browser and that `preact-textarea-autosize` used for the textarea already increases the height of the textarea when needed. Getting rid of scrollbars would solve #2939 and #3330

* add documentation
2019-09-05 18:04:24 -04:00
Jacob Herrington
287bc4432c Make report notification use theme colors (#3896) [ci skip] 2019-09-04 15:22:29 -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
Jacob Herrington
4293a00544 Update notifications reply form to use theme colors (#3894) [ci skip] 2019-09-04 08:42:54 -04:00
Andy Zhao
e25d2eaec9 Escape raw tags in codeblocks properly (#3790) 2019-09-04 08:33:46 -04:00
rhymes
78f22c3682 Simplify the images uploading code (#3907) [ci skip] 2019-09-04 08:14:59 -04:00
Ben Halpern
07ba4d8b2b
Modify headers to allow embed (#3935) 2019-09-03 16:38:04 -04:00
Jacob Herrington
81f7f73575 Format console copy (#3888) [ci skip] 2019-09-03 15:59:12 -04:00
Akshay Mahajan
c5577f68a3 Reading list: set default reading time to 1 minute (#3927)
* fixes 0 min reading time in reading list by setting the default reading time to 1 min

* Updated PropTypes for article_reading_time & reading_time to number.isRequired. Updated the relevant tests.
2019-09-03 15:50:40 -04:00
Jess Lee
3c4dce0521 remove homepage placement for bronze and silver (#3934) 2019-09-03 13:26:36 -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
rhymes
e1334e3625 Use a self explanatory name to render chat channel (#3902) [ci skip] 2019-09-03 10:19:36 -04:00
tyronasaurus-rex
c9a4ae7f6d Add pixel limit to Editors Guide (#3903) [ci skip] 2019-09-03 10:18:48 -04:00
Jacob Herrington
07944755ff Fix rubocop lints (#3922) [ci skip] 2019-09-03 10:09:48 -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
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
Mario See
3cf6a2d4bc Add singleListing specs (#3883) [ci skip] 2019-08-30 14:49:20 -04:00