* Add tests and improve pagination and caching
* Add two more specs
* Add .with_video scope
* Get rid of N+1
* Only select needed columns
* Improve efficiency of the video page as well
* Add missing set_cache_control_headers to API videos#index
* Fix article description issues
* Move tag info to decorator
* Fix description edge cases
* Fix description creation logic
* Fix test and adjust naming
* Modify line in processed_description
Surrogate keys are about setting expectations on cache purging.
Presently we use a combination of all parameters to set changing surrogate keys depending on the result of the `ArticleApiIndexService`. This approach has two limitations:
- if two set of params lead to the same exact set of articles, we still create two different caches
- deleted articles will remain for 24 hours in the cache because the cache key doesn't take the record keys into account
By simply using record keys we make sure that different params leading to the same result set will share the same cache and that deleted keys won't appear anymore in the cache.
* Add article's record key to Fastly Surrogate-Key to separate caches
After #4744 we successfully setup an auto purging system based on Fastly's surrogate key based cache and purging API.
Unfortunately this worked only in the `:show` action as comments are their own tree-based resource.
The `:index` though, is related to a single article, so without the article's record key in the `Surrogate-Key` header the first time we hit the API the result would become the value stored in Fastly's API, for all articles.
* Fix commentable mock for job spec
* Add comment.commentable.purge to the worker as well
* Add more thorough tests for commentable
* Use ancestry in the index and add test
* Add tests for show action
* Return complete comments trees for index, kill n+1 and use correct edge cache key
* Return complete comments tree for show, kill n+1 and use correct edge cache key
* Refactor tests and add surrogate keys tests
* Preload users for the whole subtree
* Clarify explanation of the edge cache keys construction
* Refactor partials
* Remove action caching
* Replace .map.flatten with .flat_map
* Fix surrogate key prefix according to Fastly docs
* Add comment.purge to Comments::BustCacheJob to use Fastly-Rails
* Fix surrogate key spec
* Remove mock from specs to test the actual Suggester
* Fix articles API top articles n+1
* Fix n+1 in articles API with state parameter
* Remove eager loading for organization dashboard
* Eager load notifiables in notifications only when needed
* Algolia does not like this
A common response in collection endpoint with REST APIs is to return an empty result set when the requested params end up in an empty result. The reason for this is that the resource itself exists (the collection always exists), it just is empty.
See https://github.com/thepracticaldev/dev.to/pull/5192
* Add infinite scroll to followers list (#258)
* Refactor fetchNext function for clarity (#258)
* Sepparate following tab into multiple tabs to support infinite scroll (#258)
* Add infinite scroll to following pages (#258)
* Add tests to infinite scroll api
* Refactor dashboard loading text
* Refactor infine scroll function
* Fix duplicated entries problem in infinite scrolling
* Switch randomized attributes to sequential to avoid InvalidRecord error
* Add acceptance tests for infinite scroll
* Remove unused following method
* parameterize limit per page for followers and followings
* Split follows endpoint into followers and followings
* Authenticate user with api key in followers and followings
* Split followers endpoint into users and organizations
* Add redundant html to sublist partial
* Speed up infinite scroll tests
* Refactor api json responses to use partials
* Authenticate api user before follows create
* Resolve conflicts on scrolling js
* Improve partials organization and fix organization username bug
* Improve readability of unauthorized test
* Use let! to create scrolling test data
* Fix not working podcasts link
* Refactor initScrolling to remove linting errors
* Fix codeclimate coding style issue
* Test tags forms and podcasts hyperlinks
* Fix eslint issue with double equals
* Improve before_action usage and readability
* Regenerate rubocop todo
* Fix outstanding problems
* Fix Style/FormatStringToken
* Final update to rubocop todo file
* Set RSpec/ExampleLength to max 10 and regenerate todo file
* 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
* 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
* 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
* /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
* 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
* Update specs for doorkeeper test
* Add bang
* Create #authenticate
* Create /api/articles/ endpoint
* Update specs
* Update me.json.jbuilder
* Fix typo and spacing
* Support pagination for #me
* Update #authenticate! to support cookies
* Make per_page a param
* Disable method-complexity check
* Enable refresh_token
* Create /api/users/me endpoint
* Reorganize PageViewsController
* Add domain and path to PageView model
* Add before_create callback to populate domain and path
* Add list of referrers to AnalyticsService
* Add referrers to the UI
* Remove useless referrers card and tweak table line height
* Add referrer stats to article stats page
* Add not null and empty default to domain and path
* Refactor JS analytics client
* create_list is a step back here
* Revert "Add not null and empty default to domain and path"
This reverts commit bc02440076047a887c65d300bccd4661ecc8ffd0.
* Add index on domain concurrently
* Make the script more robust
* Use proper auth chain before checking parameters
* Refactor AnalyticsController
* Add a bunch of test and rewrite reactions counts with a single query
* Add tests for follows totals
* Use round and add more refactoring
* Add tests to group by day to fallback during refactoring
* Use group by to calculate comments count by day
* Use group by to calculate follows count by day
* Use group by to calculate reactions stats by day
* Use group by to calculate page_views stats by day
* Move calculations per day back in the cached block
* Add a few comments and a little bit of refactoring
* Add indexes (concurrently) for analytics
* Make tests more time robust
* Use a date range cache related to the requesting user or org
* Freezing time in UTC should help when tests are ran on time zones over the day line
* Remove explicit returns
* Page title is escaped, guard against that
* Move Analytics service spec in the proper place
* Allow user to have many orgs
* Allow users to handle multi orgs in settings
* Make rounded buttons inline
* Add multi org function to dashboards
* Fix merge conflicts
* Fix mistake in merge conflict fix oops
* Display the correct membership level
* Fix accessibility issues
* Display organizations for article editors
* Handle submitting org id with preact editors
* Make listings work with multiple organizations
* Allow listings to have multiple orgs on create
* Display the correct number of credits for each org
* Move script tag to Webpack
* Allow multi orgs for purchasing and viewing credits
* Use OrganizationMembership as authorization check
* Display multiple organizations for notifications
* Allow dashboard to be viewable under multi-orgs
* Remove unused method
* Add multi-org functionality for article editors
* Show pro dashboard buttons for member+ org levels
* Leave the correct organization
* Allow article API to change org id
* Add left-out authorization method oops
* Make nav buttons a bit more clear
* Fix merge conflict
* Fix adding org id for /api/articles and tests
* Fix tests for org policy
* Use proper logic for displaying org members
* Update org actions with new authorization
* Use correct org when creating a listing
* Remove additional payment charge oops
* Mark org notifications as read with authorization
* Remove deprecated post_as_organization attribute
* Use new org_admin syntax
* Remove deprecated org logic for article create and update
* Default all RSS posts to not belong to any org
* Render org_member page for guest users
* Update org policy spec to work with multi orgs
* Use org_membership for org traits and move identity code
* Use org_member trait
* Update to work with multi-orgs
* Validate article's org_id if param org_id is blank
* Make a let variable
* Remove unnecessary eager load for credits
* Fix HTML structure and org logic for non-org users
* Update credits spec for multi-org
* Add test for failed payment when purchased by org
* Lint listings_spec
* Test that the listing was created under the user
* Add tests for POST /listings multi-org
* Use double quotes for classes
* Fix /manage and a few other multi-org bugs
* Fix test for multi org
* Use correct method SQL exists? not Rails exist?
* Fix reads spec for multi-org
* Fix org_controller actions to work with multi org
* Test only multi org and not old usage and fix leave_org
* Fix org showing user profile img test for multi-org
* Fix org logic for users with no orgs
* Remove switch org functionality
* Update tests and add hidden param for org id
* Redirect to the specific organization
* Test other org button actions
* Use settings_notice instead of legacy notice and refactor
* Fix weird extra end issue prob from merge conflicts
* Test for with new flash key
* Fix user_views_org tests for multi-org
* Test for new flash message
* Update snapshot with new a11y html
* Move styling to stylesheet
* Add site admins functionality
* Move org_member? method in user model and refactor
* Use unspent_credits_count for organizations
* Add tests for /listings/new and minor bug fixes
* Use .present? in case of empty array
* Fix a lingering deprecated method
* Use greater than 1 for random numbers
* Add tests for counting spent and unspent credits
* Allow the article to be assigned to an org on update
* Add all the relevant datetimes, those available in the export
* Not all dates are always available