Commit graph

167 commits

Author SHA1 Message Date
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
Ben Halpern
6c2498b1b8
Render correct editor based on article's existing format (#2856)
* Render correct editor based on article's existing format

* Add check for user in /new
2019-05-16 15:25:43 -04:00
cyrillefr
68f06c2076 send_milestone_notification in own job (#2804)
- that calls a service
  - spec for job + move spec to service
  - minor refactoring
2019-05-16 13:46:50 -04:00
Anna Buianova
dd0fbf002b ActiveJob for updating notifications #1996 (#2839)
* Notifications::Update service

* Update notifications ActiveJob

* Raise an exception when wrong notifiable class passed to a job
2019-05-15 12:37:25 -04:00
Kobe Raypole
509c7a3388 Move async article methods to ActiveJob (#2647) 2019-05-10 12:52:00 -04:00
cyrillefr
ecdbee64ab Move tag adjustment notification to Active Jobs (#2654) 2019-05-10 11:06:29 -04:00
rhymes
e626002260 Add alternative texts to images (#2771) [ci skip] 2019-05-09 11:16:03 -04:00
rhymes
4e591fea1c Show localized date/time on hover for articles/comments (#2722)
* Add article decorator published_timestamp

* Use time HTML5 element and refactor date in partial

* Add published_timestamp to Article

Adding `published_timestamp` to the homepage we can then use JS to render the full timestamp localized for the user.

We've also added the timestamp to the index and the API

* Display article published timestamp on hover

* Use time also in the article show page

* Add timestamp to bottom articles as well

* Remove published_timestamp from index because it is not used

* Fix broken specs

* Add more article dates specs

* Refactor date initializers
2019-05-09 11:05:17 -04:00
Ben Halpern
41d3f7ef39
Add credits counter_culter to users and orgs (#2689) 2019-05-04 10:50:48 -04:00
Ben Halpern
15ea00328c
Award credits along with badge achievements (#2683) 2019-05-03 15:38:25 -04:00
Ben Halpern
5891b2ea58
Add application "page" model (#2657)
* Generate page model

* Add page model

* Conditionally modify html rendering
2019-05-02 18:24:06 -04:00
Ben Halpern
f12f00decd
Add profile_image_90 to serialized data on article (#2661) 2019-05-02 15:47:22 -04:00
Ben Halpern
821d45104a
Create serialized cached user and cached organization for articles (#2658)
* Create cached user and cached organization for articles

* Remove pages table
2019-05-02 14:42:28 -04:00
Anna Buianova
065ef29e31 Added unique index to notifications #2124 (#2213)
* Added unique index to notifications #2124

* Fix migration + add index to schema.rb

* Shoulda matcher notification unique validation
2019-05-01 13:15:06 -04:00
Ben Halpern
158f56bc9d
Add page for users to "manage" their posts after publication (distribution, etc.) (#2627)
* Set up basic /manage route

* Add basic article manage page

* Add tips and finalize permissions for /manage

* Add final test and add manage button to article show

* Update failing specs
2019-05-01 09:00:09 -04:00
Anna Buianova
dd11478659 Change format of the user languages_settings #2369 (#2496)
* Change format of user preferred languages

* Make sure user language settings are set by default

* Add missing expect to the user spec

* Fix users/misc template

* Move existing languages to a constant

* Remove commented user code

* Move languages out of User model

* Update preferred languages accordingly to the available languages

* Set user estimated language only if the language is available

* Fix Portuguese spelling #2582
2019-04-30 17:01:19 -04:00
Anna Buianova
d2d405ad37 Add validation to classified_listings user and organization (#2625) 2019-04-30 09:35:08 -04:00
rhymes
af83bab2d0 Escape range separator (#2593)
The char "-" in regexp defaults a a separator for a range of character, for example: "a-z", Ruby is smart enough to understand "-_" is no range but it does emit a warning, by properly escaping the char "-" we ensure that no warning or issues can arise in the future.
2019-04-29 14:27:26 -04:00
rhymes
743316b528 Move send new badge achievement notification to ActiveJob (#2474) 2019-04-29 10:51:08 -04:00
Ben Halpern
076047e13b
Add proper filtering for inappropriate tags in listings (#2611) 2019-04-29 09:21:42 -04:00
Bolarinwa Balogun
1578befdf1 Add Twitch to Profile Links (#2557) 2019-04-25 16:14:28 -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
rhymes
9d2c89fd2f Upgrade factory_bot_rails to 5.2.0 (#2532) [ci skip] 2019-04-23 13:21:22 -04:00
Andy Zhao
182a787ac4 Add OrganizationMembership model (#2471)
* Remove deprecated analytics role

* Make anchor tag a bit more readable

* Add OrganizationMembership table and model

* Add organization_membership associations

* Add unique indices for user_id and org_id

* Wrap update and create calls in transactions

* Remove specs of deprecated analytics_beta_tester
2019-04-22 14:08:02 -04:00
Andy Zhao
4e8787f606 Convert underscores in article slugs properly (#2472) 2019-04-17 12:35:37 -04:00
rhymes
7d3fb0c0b5 Enable random order for specs (#2466) [ci skip] 2019-04-17 11:30:23 -04:00
Ben Halpern
4b1b137c0f
Fix/augment dashboard and article view count issues (#2449) 2019-04-15 10:24:38 -04:00
Anna Buianova
d27874adc9 Move estimating user default language to ActiveJob (#2373)
* Move estimating user language logic to a service object

* Call a service from a User#estimate_default_language!

* ActiveJob for estimating default user language

* Call ActiveJob from the User#estimate_default_language

* Handle nil user email when estimating default language

* Switch user.estimate_default_language_without_delay! to estimate_default_language! in specs
2019-04-13 15:54:22 -04:00
Ali Spittel
409c280c10 pinkify DEV (#2425) 2019-04-13 11:25:02 -04:00
rhymes
d0441bb456 Enable Rails/TimeZone cop (#2334) [ci skip] 2019-04-09 15:38:28 -04:00