Commit graph

29 commits

Author SHA1 Message Date
Michael Kohl
c23850f795
[deploy] Credit refactoring (#7841)
* Simplify Credit model

* Use enough_credits? method
2020-05-14 18:04:26 -04:00
Alex
004dbba500
[deploy] Remove logging of image data to Datadog (#7829) 2020-05-13 16:23:42 -04:00
Michael Kohl
79f1f5f0c8
Change string concatenation to interpolation (#7680)
* Change string concatenation to interpolation

* Replace more concatenation with interpolation

* Add forgotten interpolation
2020-05-06 17:13:10 +02:00
Molly Struve
caadf27288
[deploy] Rate Limit Classified Listing Creation (#7684) 2020-05-05 12:01:27 -05:00
Alex
5060652939
Validate images are files (#7639)
* Validate images are files

* Skip image validation if there aren't any images
2020-05-01 10:39:20 -04:00
Michael Kohl
46f94b135d
[deploy] Classified listings refactor part 3 (#7498)
* Ignore category column

* Move view oriented class methods to helper

* Start refactoring ClassifiedListingsToolkit

* Add attr_accessor instead of category

* Replace old category column with association

* More cleanup

* Trigger Travis

* Don't rename associations, category_slug -> category

* Indiana Kohl and the missing newline

* More refactoring and spec fixes

* Add dashboard for classified listing categories

* Remove TODO comment

Co-authored-by: rhymes <rhymesete@gmail.com>
2020-04-30 18:57:01 -04:00
Alex
b6664456c0
[deploy] Validate filenames server-side (#7405) 2020-04-23 14:30:59 -05:00
Michael Kohl
9df68f3920
Use new classified listing categories (#7250)
* Add ClassifiedListingCategoryModel

* Add data update script for classified listing categories

* Refactor and fix specs

* Resolve conflict

* Incorporate PR feedback
2020-04-23 10:06:58 +07:00
Alex
915f92f2ab
[deploy] Copy set_surrogate_key_header from fastly-rails (#7108) 2020-04-07 12:04:55 -04:00
Alex
932f81afe6
Copy set_cache_control_headers from fastly-rails (#7070) [deploy]
* Copy controller actions from fastly-rails

* Move logic to FastlyHeaders controller concern

- Only add cache-control headers
2020-04-06 13:06:27 -04:00
Jacob Herrington
38d56542eb
[deploy] Moderator and admin actions log (#6797)
* Add audit logging for negative reactions

This change saves requests that create negative reactions to the audit
log. We need to be monitoring admin and moderator actions throughout the
app to increase visiblity on how our tools are being used and identify
abuse.

Additionally, this will help east concerns about giving elevated users
more powerful tools.

* Add a basic UI for moderator audit logs

* Log experience level ratings

* Log tag adjustments

* UI tweaks for moderator actions log

* Add logging to internal reactions controller

* Add logging for admin actions on users and articles

* Add searching to the moderator actions table

* Move audit instrumentation out of concern

We are able to use a PORO here instead of using a Rails concern. Moving
this also makes syntax to audit something quite a bit more explicit and
obvious to future developers

* Change moderator logs pagination page length

* Move auditing to after action filters

* Add moderator actions to the internal navbar

* Add request spec for internal moderator actions

* Use request params to populate AuditLog slug
2020-03-26 16:59:24 -05: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
Alex
07d3991bc8
Remove Algolia for ClassifiedListings (#6435) [deploy] 2020-03-04 08:36:14 -05:00
Alain Mauri
c013079359 Move Classified Listing Cache Buster to Sidekiq (#5408) [deploy]
* Created the worker to bust cache for classified listings
* Created the related tests
* Removed the old job
2020-01-09 17:23:23 -05:00
Molly Struve
1966c449ed
scope error message correctly for InvalidAuthenticityToken error (#5375) [deploy] 2020-01-06 11:45:28 -05:00
Molly Struve
cb48e431d2
Correctly define token error in helper module (#5337) 2020-01-03 12:39:57 -05:00
Ben Halpern
07a7e9c075
Monkeypatch method to ensure https redirect (#5145) [deploy] 2019-12-16 18:15:14 -05:00
Ben Halpern
b938dab91b
Add ApplicationMetalController to relevant controllers (#4937)
* Add ApplicationMetalController to relevant controllers

* Add request forgery protection to metal

* Remove logger call

* Add logger keyword and skip protect_from_forgery in test

* Uncomment main_image in test
2019-11-26 16:29:07 -05:00
rhymes
0ffa127481 Refactor session_current_user_id in a shared concern (#4936) 2019-11-26 13:21:56 -05:00
Branko Arnaudovski
efbb108061 Implement Moderators audit logs (#3449) 2019-10-23 10:30:45 -04: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
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
47c2885810 Listings set custom expiry date (#3770)
* add expire_on column to classified_listings

* add expire_on to valid listing params

* add expire_on to model

* add expire date to new listing form

* add field in edit form

* add expiry dates to dashboard

* update expiry date in listing toolkit

* WIP unpublish job and test

test still has to run properly

* add job to class name

* change job to rake task

* revert snap change

* delete migration file

will add new one and revert schema changes to rename column

* reset schema

* add new migration to schema 'expires_at'

* change expire_on to expires_at
2019-08-23 17:33:50 -04:00
Mario See
11be56f38c Add location to listings (#3370)
* add location to classified_listings

create rails migration and ran rake db:migrate

* add faker city to seed

* add location to index json

* add location as searchable attribute in algolia

* add form text field for adding location to new listing

* add location to dashboard json

* add location field for editing listings

* add location to listing_params in controller

* add location to single listing view

* add location to listing row in dashboard

* add location to dashboard test

* adjust listing dashboard row spacing

* reduce character limit

* reduce lines of conditional html elements

* compress listing card const

* fix form call for location in edit page

* update snapshot in dashboard

* add location length validation in listing model

* shorten limit and update location in edit page
2019-07-10 12:45:41 -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
0267d4e829 Move bust_cache methods in own jobs (#3071) 2019-06-24 13:28:25 -04:00
Jess Lee
5ca069f93f Fix listings cache/indexing and add bumping feature to internal (#3053)
* wip utilize concerns

* wip concerns

* refactor listings update
2019-06-06 09:51:32 -04:00
Edem Attikese
0ad8cd9eab Edem/improvements/pundit coverage (#498)
* added organization policy + spec

* user specs for is_org_admin?

* added authroize to organization controller

* admin policy + specs

* deleted enforce admin due to pundit policy redundancy

* applied admin policy to entire admin namespace

* refactoring analytics controller WIP - wanna test codeship

* Add protection against reactions to unpublished articles (#473)

* Add chat channel policy and spec (#474)

* Add comment policy and specs (#475)

* Fix edge case with apostrophes

* Add comment policy and specs

* Add login for deleting comment spec

* Change test to raise pundit error instead of 404

* Clean up comment destroy request specs

* Remove redundant raise

* Whitelist columns on to_json call (#477)

* Add pundit policy for several controllers (#476)

* Add pundit policy for several controllers

* Adjust video spec

* Fix tag request specs

* Add proper twilio tokens request specs

* Remove puts statements

* Add a couple basic request specs (#478)

* Add a few tests and fix user tag color bug (#482)

* Refactor handle_tag_index in stories_controller (#481)

* Modify valid_request_origin? (#483)

* Add misc specs and remove banned attribute from user model (#484)

*  Fix missing Cloudinary tags and misc specs (#486)

* removing current_user_is_admin? to use .is_admin? method

* added missing org policy routes

* Add comment for all public controllers

* Fix edge case for test

* Authorize mod controller and add specs

* Refactor methods via inheritance and use only super_admin role

* Create policy method for analytics via article_policy and refactor

* Capitalize all buttons in dashboard page

* Fix org tests and remove old admin test

* Use only happy path for analytics

* Fix tests to use Pundit error

* Update org_policy spec
2018-06-28 09:38:20 -04:00
Mac Siri
301c6080e3 Initial commit 2018-02-28 16:11:08 -05:00