Commit graph

27 commits

Author SHA1 Message Date
rhymes
c41d66e900
Replace ban/banned with suspend/suspended in user facing text (#5816) [deploy] 2020-02-10 10:12:53 -05:00
Nadiya Karachevska
e49b0e81e5 Return 404 NotFound error if ClassifiedListing is not found during delete (#5646) 2020-01-22 13:07:44 -05: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
Ben Halpern
a287263875
Remove listings privileges from banned users (#3784) 2019-08-21 16:44:27 -04:00
Mario See
da79b443a6 allow nil assignment (#3711) 2019-08-13 17:19:57 -03:00
Mario See
657d88ca13 Direct listing links only show listing if published (#3645)
* displayed_classified_listing should be published

* remove redundant line

* Update classified_listings_controller.rb

* update get request tests
2019-08-13 11:53:53 -03:00
Mario See
197cd562ed Bump organization listings with organization credits (#3489)
* add org to update listing if bumping

* add credits redirect

* remove unnecessary auth

* fix auth and separate transaction

* update spec to match additional bump logic
2019-07-29 11:57:15 -04:00
Kitten King
6290451273 Fix Typos (#3510) 2019-07-22 12:56:48 -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
Mario See
abbc3e85d6 Manage listings as organization admin (#3228)
* adjust validations to allow org admins to edit listings

also adjusted presented elements based on bumped_at dates and published boolean status

* allow org admins to edit listings under diff user_id

adjust statement in edit so that it has to be admin not just member

* pluck via attribute not string of attribute name

* update policy for org admins

* make authorizing org admin for listing private

* update classified listing spec

user_id is required for classified listing
2019-06-20 09:39:54 -04:00
rhymes
6ce6b265df Fixed a couple of queries (#3233) 2019-06-19 09:17:03 -04:00
Mario See
9e616de9f8 Listings Dashboard (#3014)
* init wip react components

* wip add dashboard to listing views

- create a html.erb view to hold listing/dashboard with javascript_pack_tag
- create listingDashboard.jsx in packs
- create listingDashboard component and dashboard folder with smaller components
- added view to controller and routes

* slowly adding some formatting

adjusted styling, info

* remove listing body from dashboard

* add some styling and adjust info

* wip adding org listings

* wip multi org in dashboard

* adjust for multi org

* add styling and better multi org support

* comment out bump and delete -- save for upcoming PR

* reduce lines

* listing form has link to listings dashboard instead of listings

* adjust header boxes flex direction for mobile

* fix organization id query

* WIP testing

needs more rigorous tests

* finalize tests
2019-06-18 14:52:59 -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
Andy Zhao
47d9ec27fb Allow users to belong to multiple orgs (#2583)
* 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
2019-06-04 09:30:52 -04:00
Mario See
19b46a86e2 Add messaging option in listings (#2854)
* add prop for message modal method

* clean up comments from open inbox method

* add inbox type to listing model author

* add sample methods for opening message modal in listings and listing modal

* only show for users with open inbox and hide for self

* use contact_via_connect instead of inbox_type

* fix edit listing to include contact via connect attribute

* wip send message method

* adjust message styling

* change id name

* update destination

* remove unused methods
2019-05-31 13:48:45 -04:00
Ben Halpern
2aa01d44a2
Add listings to home page (#2912) 2019-05-21 10:21:49 -04:00
Andy Zhao
bb75ee3fc6 WIP Add proper error handling when creating a listing (#2755)
* Add proper error handling when creating a listing

* Remove accidentally committed stylesheet

* Make error text

* Preserve input values if the submission is invalid
2019-05-07 18:25:25 -04:00
Jess Lee
436fa2788c redirect /moderate to internal listings view (#2730) 2019-05-07 07:00:18 -04:00
Ben Halpern
9e7dbf8356
Update JS listings form and other tweaks (#2697) 2019-05-05 10:14:07 -04:00
Jess Lee
3743240e92 Deduct credits from proper account (personal vs org) (#2679)
* wip

* continue wip

* deduct credits from proper account
2019-05-03 13:54:16 -04:00
Jess Lee
5e193fdcd7 Create listings permalink (#2637)
* create listings show route

* add link to listings

* include slug in json

* migrate test environment

* unlink listing title

* fix formatting

* remove slug data from json

* remove auto linting

* fix spacing

* add to algolia index?

* actually add index?

* fix merge conflicts?

* update query
2019-05-02 14:14:40 -04:00
Ben Halpern
3f92ac4919
Fix/improve edits for listings (#2555)
* Fix the edit process for listings

* Add category to listing

* Fix issue in listing update
2019-04-25 16:12:50 -04:00
Anna Buianova
46b1b1d28a Fix lints (#2553) [ci skip] 2019-04-25 07:56:15 -04:00
Ben Halpern
78138532c8
Classified Listings (#2545)
* Initial classified listings work

* More work on tags

* Additional work finalizing stripe and getting the listings page along

* Finalize-ish listings 🤞
2019-04-24 16:17:01 -04:00