Commit graph

197 commits

Author SHA1 Message Date
rhymes
cecd1db070 Sponsorship: business logic (step 2) (#3440)
* Add Sponsorship model

* Add Sponsorship to admin

* Add correct relationships between models

* Add temporary script to migrate sponsorship data

* Use constants for enums

* Use Sponsorship model in PartnershipsController

* Use Sponsorship in the views

* Validate sponsorship levels and tag combos

* Replace the rest of the sponsorship code to use Sponsorship
2019-07-10 16:40:56 -04:00
rhymes
ad79116366 Sponsorship: add model (step 1) (#3438)
* Add Sponsorship model

* Add Sponsorship to admin

* Add correct relationships between models

* Add temporary script to migrate sponsorship data
2019-07-10 15:58:37 -04:00
Ben Halpern
87002e5786
Fix profile pin display limit (#3427) 2019-07-09 15:42:46 -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
rhymes
5db8b7e1e5 Fix Rubocop lint (#3423) [ci skip] 2019-07-09 09:06:38 -04:00
Ben Halpern
a5ccfb2b32
Add history to sidebar for pro users (#3417)
* Add history to sidebar for pro users

* Add filmstrip image
2019-07-08 18:10:01 -04:00
Edison Yap
8ffe0f3de3 Bust cache for articles in series (#3052) 2019-07-08 17:28:27 -04:00
Mac Siri
d997ffee4f
Run yarn upgrade (#3419) 2019-07-08 17:03:19 -04:00
Anna Buianova
c3ed38f832 Moved creating a new podcast to a separate ActiveJob #2952 (#3373)
* Podcasts reachable status #2952

* Specs for podcasts statuses

* Moved podcast episode create to a separate ActiveJob

* Use RssItemData wrapper in GetEpisode for consistency

* Reorganize services/podcasts
2019-07-04 13:10:54 -04:00
Andy Zhao
22e76bee84 Add functionality to remove and recover identity (#3377)
* Lint some quotation marks

* Add BackupData table

* Add identity and removal functionality

* Test additional functionality

* Remove dependent destroy for backup data

* Add auth_data_dump column

* Add challenge to reserved words

* Add more shoulda matchers
2019-07-03 12:01:16 -04:00
Anna Buianova
186e5bb52b Fix lint (#3342) [ci skip] 2019-07-01 11:32:28 -04:00
Mazen Touati
6797567de9 Fix instagram URL validation rule (#3336) 2019-07-01 08:16:34 -04:00
Anna Buianova
7ee0350ac5 Refactored and optimized getting existing podcast episode (#3319)
* Refactored and optimized getting existing podcast episode

* Podcast#existing_episode fixes
2019-06-27 11:50:27 -04:00
Ben Halpern
26af371ebd
Fix comment title encoding issue (#3311)
* Fix comment title encoding issue

* Remove puts statements

* Fix flaky test

* Change flaky test

* Add & fix
2019-06-26 15:24:05 -04:00
Bolarinwa Balogun
dbc4abc587 Add rel="nofollow" to links in comments (#3304)
* Add rel="nofollow" to links in comments

* Improve code quality and Add tests
2019-06-26 09:02:11 -04:00
Bolarinwa Balogun
b52d8e931d Add Instagram URL to profile links (#3307) 2019-06-26 08:56:07 -04:00
rhymes
7da7a16d8d Pro: add referrers to dashboard and single article stats (#3295)
* 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
2019-06-25 13:58:09 -04:00
Eduardo Alencar
6d800da4d4 Increase tag length from 20 to 30 chars (#3299)
This commit increases the tag length from 20 to 30 chars and also increases the cached_tag_list length to maintain the limit of 4 tags. Specs were adapted to respect the changes.
2019-06-24 16:43:21 -04:00
Ben Halpern
dcbb188cf1
Add pinned articles box to profiles (#3269)
* Initial pins work

* Add pin box to profiles

* Fix test snapshot spacing and optimize svg

* Fix listings spacing
2019-06-24 15:18:29 -04:00
cyrillefr
0267d4e829 Move bust_cache methods in own jobs (#3071) 2019-06-24 13:28:25 -04:00
rhymes
6cdc604333 Rubocop: disable style rule and fix some issues (#3278) [ci skip] 2019-06-24 12:20:29 -04:00
Ben Halpern
d48ad63aea
Add comment context for notifications and comment pages (#3262)
* Add comment context for notifications and comment pages

* Fix comment spec and adjust css
2019-06-22 14:50:15 -04:00
rhymes
91de529705 Remove code for legacy mentoring feature (#3186) 2019-06-21 17:18:11 -04:00
Anna Buianova
f79b3cb12a Fixed rubocop issues, new .rubocop_todo.yml (#3255)
* Fixed rubocop issues, new .rubocop_todo.yml

* Refined and fixed indentation
2019-06-21 14:26:39 -04:00
Andy Zhao
cf8b4e37d3 Add context data to comment notifications (#3258)
* Add db relationship for comment and notifications

* Use delete instead of destroy

* Add comment's ancestors' data

* Delete descendant notification data appropriately

* Update notifications for comments up the tree as well

* Update descendant notifications appropriately

* Fix apostrophe edge case

* Make ancestor_data method private
2019-06-21 14:26:19 -04:00
Andy Zhao
4ca7197696 Delete a comment's title if it is deleted (#3249)
* Remove cursor pointer for notification cards

* Delete the comment title if deleted

* Update title to use comment's title
2019-06-20 15:48:21 -04:00
Andy Zhao
1e61634499 Add backend functionality for muting users you follow (#3240)
* Add backend func. for muting users you follow

* Remove comment

* Add validations and update default value

* Send notifications to followers with all_articles
2019-06-20 11:28:50 -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
Anna Buianova
a3e246a327 Fix mention validation when validating an empty instance (#3188)
* Fix mention validation when validating an empty instance

* Fix NotifyMailer spec
2019-06-18 21:36:01 -04:00
Mazen Touati
b284c1e9df Allow stackoverflow subcommunities profiles (#3215) 2019-06-18 21:35:16 -04:00
rhymes
f9fb76ec97 Remove double presence validator in PollVote (#3187) [ci skip] 2019-06-17 10:28:05 -04:00
Ben Halpern
13bfdf2b64
Add minimal light theme (#3179) 2019-06-16 01:37:34 -04:00
Ben Halpern
456931f208
Further generalize pages and site Twitter handle (#3177)
* Further generalize pages and site Twitter handle

* Add footer mod change

* Remove giveaways dead code
2019-06-16 00:59:11 -04:00
Ben Halpern
8ae057b06e
Beta polls feature (admin use only for now) (#3176)
* Initial poll features

* Add basic poll functionality

* Finish (maybe) beta poll functionality
2019-06-15 17:33:30 -04:00
Andy Zhao
b953f17d0c New Feature: Subscribe to posts! (#3149)
* Add MVP of notification subscriptions

* Add rate limiting for notification subscriptions

* Show modal for logged out users on subscribe click

* Add enter key functionality for checkbox

* Add relationships for notification subscriptions

* Add model test for notification subscription

* Deprecated article mutes in favor of notification subscriptions

* Deprecated comment mutes in favor of notification subscriptions

* Move comment muting tests and logic over

* Merge comment and article muting into subscriptions

* Remove redundant check

* Use database to check for rate limit instead of cache

* Test for subscriptions handling notifications properly

* Fix notification model spec for subscriptions

* Fix tests for subscriptions

* Remove rate limiting

* Properly handle logged out users getting subscription status

* Fix test for new pattern

* Update reserved words

* Add config column to notification subscriptions

* Add logic for top level config and move tests

* Test for top level subscribers getting notified

* Fix logic mistake oops

* Add index and refactor comment_user_ids
2019-06-14 12:03:43 -04:00
rhymes
7f2045b250 Pro Analytics: stats for a single article (#3120)
* Add /stats endpoint for articles, opened only to Pro users

* Add analytics to article stats page

* Add stats button to the article page and test stats page
2019-06-13 19:02:09 -04:00
Anna Buianova
58db43d0d4 Validate usernames and organization slugs against podcast slugs (#3148) 2019-06-13 19:00:25 -04:00
Anna Buianova
2c05bbc0c1 Change notifications unique indexes #2525 (#3012)
* Notifications unique indexes that take null values into account

* Specify import options for reaction notifications according to the indexes

* Fix specs: notifications have either user_id or organization_id

* Create notifications indexes concurrently
2019-06-13 15:17:50 -04:00
Anna Buianova
f476e11be6 Podcasts validations (#3123)
* Podcasts validations

* Added db constraints for podcast_episodes

* Validate podcast slug uniqueness with usernames and org slugs

* Validate podcast slug uniqueness only if it was changed
2019-06-13 12:45:05 -04:00
Arun Kumar Mohan
3188ddaa8a Remove dead code (#3146) 2019-06-13 11:10:38 -04:00
Kartikey Tanna
858ce184e5 Implement ActiveJob for Mention (#3055)
* Implemented ActiveJob for Mention#send_email_notification

* Implemented ActiveJob for Mention.create_all

* Fixed args while calling the job

* Changes as per the review
2019-06-13 11:05:22 -04:00
Andy Zhao
9832d0cfc1 Destroy organization memberships if user is destroyed (#3125) 2019-06-11 15:54:24 -04:00
Ben Halpern
b731df44ca
Add badges to key tags (#3074)
* Add badges to key tags

* Adjust vertical-align

* Fix YouTube tag mistake and refactor map to pluck
2019-06-07 19:09:43 -04:00
Anna Buianova
8b55d32640 Rubocop fixes (#3058) 2019-06-06 09:48:14 -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
cyrillefr
8c52d5c43f Move remove_each notifications method in own job (#2946) 2019-05-29 16:26:18 -04:00
Anna Buianova
c510f1510c Fix a validation error when creating notifications #2525 (#2999)
* Use activerecord-import upsert to deal with the race condition

* Return a more consistent result form Notifications::Reactions::Send
2019-05-29 11:19:37 -04:00
Mac Siri
6d1638ed68 Unskip all skipped specs (#2941)
* Change all login_as to sign_in

* Unskip comment spec

* Create new specs

* Turn on Webdriver caching

* Set logger for Omniauth in test

* Update editor system spec

* Fix editor approval file

* Update video_controller

* Update TagAdjustmentUpdateService's spec

* Update users api spec

* Update stories_index_spec

* Remove redundant spec file

* Remove residual code

* Change ClassifiedListing spec

* Update NotificationsIndex spec
2019-05-25 11:04:38 -04:00
Ben Halpern
37fabd08b1
Fix some connect bugs with wrong url and remove some dead code (#2953) 2019-05-24 12:19:59 -04:00
Anna Buianova
a6091fe6c8 Moved notifying followers to a separate ActiveJob #1996 (#2935)
* Moved notifying followers to a service + specs

* Created an ActiveJob for notifiable action notifications

* Call the job from the Notification#send_to_followers

* Refactor creating notifiable action notification

* Handle possible nil followers while sending notifiable action notification

* Use activerecord import to bulk-create notifications

* Set notified_at for the bulk-created notifications

* Move compact to the appropriate place
2019-05-24 07:45:51 -04:00