Commit graph

525 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
Ben Halpern
85e3be1f48
Create comments notification subscription upon creation (#3167)
* Create comments notification subscription upon creation

* Fix test
2019-06-14 20:11:58 -04:00
Jess Lee
10674aed72 Buffer Listings (#2956)
* add share to buffer button

* wip

* wip

* adds listings to buffer via form

* create migration for buffered timestamp and update seed file

* display when listing was last buffered

* remove annoying spacing

* refactor article script for listings

* social preview wip

* add custom social card for indivdual listings

* add styling

* fix css

* tweak styling

* final css tweaks

* fix branch

* add buffer listings id

* update envfile

* add social previews spec
2019-06-14 19:33:19 -04:00
Ben Halpern
e130400e9e
Finalize UI for all types of notification settings (#3164) 2019-06-14 18:28:38 -04:00
Samyuktha J
74ecf5ca06 Make LinkTag's mininum reading time to 1 min (#3084) [ci skip] 2019-06-14 14:44:48 -04:00
rhymes
aa29a5cb55 Fix analytics grouped by day with nil page views average (#3159) 2019-06-14 13:30:04 -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
Mac Siri
94c78173d1 Add missing image param (#3150) 2019-06-13 14:10:14 -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
Anna Buianova
b630fcad0d Removed fetching podcasts from a callback (#3098)
* Removed fetching podcasts from a callback

* Remove hacks that avoid fetching podcasts while seeding and running tests
2019-06-13 12:23:55 -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
Anna Buianova
18d1300341 Moved SlackBot.delay.ping calls to ActiveJob #3136 (#3139)
* Moved SlackBot.delay.ping calls to ActiveJob

* Removed unused user creation from the spec
2019-06-12 09:23:37 -04:00
Andy Zhao
9832d0cfc1 Destroy organization memberships if user is destroyed (#3125) 2019-06-11 15:54:24 -04:00
rhymes
e48c9668fd Fix access token revoking (#3131)
* Move API secret ID inside the form

* Add tests for unknown and unauthorized API secrets

* Use Rails conventions a little better
2019-06-11 15:53:58 -04:00
Mac Siri
bc7c23e241
Fix inconsistent spec (#3113) [ci skip]
* Fix inconsistent spec due to zonebie

* Update spec
2019-06-10 17:33:44 -04:00
rhymes
a8b7f6eea4 Analytics: refactoring for speed improvements (#3072)
* 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
2019-06-10 09:27:39 -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
Ben Halpern
a3a9f51103
Fix improper archive redirect (#3064) 2019-06-06 17:03:59 -04:00
Anna Buianova
9751e84549 Moved Podcast#pull_all_episodes to a separate ActiveJob #2952 #2497 (#3057)
* Use one PodcastFeed instance while fetching podcasts

* Moved Podcast#pull_all_episodes to a separate ActiveJob
2019-06-06 09:49:10 -04:00
Anna Buianova
8b55d32640 Rubocop fixes (#3058) 2019-06-06 09:48:14 -04:00
Ben Halpern
df44cbd254
Change design of main feed CTA and remove from tag pages (#3050)
* Change design of main feed CTA and remove from tag pages (to prevent complexity)

* Lock Chromedriver to 74.0.3729.6

* Fix tests and modify reserved words (tack on)

* Removed less useful shared examples from rspec

* Remove references to file that no longer exists in test

* Remove unneeded tests
2019-06-05 14:33:22 -04:00
Anna Buianova
f6bb00a26a Add specs for the PodcastFeed #2952 (#3039) [ci skip] 2019-06-04 14:50:25 -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
Andy Zhao
c2d3384f80 Fix 404 issue when submitting abuse report (#3038) 2019-06-03 19:24:24 -04:00
Mac Siri
cea77663ad Fix flaky editor spec & change dev configs (#3022)
* Update .simplecov

* Downgrade factory_bot_rails

* Update flaky test

* Update .travis.yml

* Update user_edits_an_article_spec
2019-06-03 15:01:05 -04:00
briwa
b35fc23a82 refactor(svgs): remove empty group tags (#3002)
* refactor(svgs): remove empty group tags

* fix(spec): update liquid tag twitter spec
2019-05-31 08:54:31 -04:00
cyrillefr
8c52d5c43f Move remove_each notifications method in own job (#2946) 2019-05-29 16:26:18 -04:00
rhymes
a99c072525 Guard bust_comment against nil commentable (#2991) 2019-05-29 14:03:20 -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
rhymes
6a626e819d Refactor: fix issues raised by bullet (#2965)
* Preload organization, not user

* Preload users only when needed

* Pre-load podcasts for podcast episodes in API

* Avoid eager loading error by loading rating votes separately

* Preload associations for moderation

* Preload user comments in trees

* Preload organization for non org dashboard and cleanup queries

* Optimize ArticleSuggester to only load N articles at need

* Remove eager loading and pass variables to partials for easier debug

* Reorganize tags validation code and ignore actsastaggableon eager loading issues

* Remove unused eager loading and bring up comments relation

* Preload podcasts when loading podcast episodes

* Fix views specs

* Make sure ArticleSuggester never returns duplicates

* Remove commented code

* Re-trigger build

* Move suggested articles back to view to respect fragment caching
2019-05-28 17:32:53 -04:00
Vince Blom
bfc961b3f3 Codepen Links with Underscore Usernames (#2985)
- updates codepen liquid tag regex to allow underscores
- adds test to ensure an underscore in the username field of the link
  is considered valid
2019-05-28 16:32:34 -04:00
Kartikey Tanna
b16fa4f8cc Implemented ActiveJob for badge_achievements#send_email_notification (#2962)
* Implemented ActiveJob for badge_achievements#send_email_notification

* Sending email only if record not nil

As per the review
2019-05-27 09:44:38 -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
d3f9050be7 Move updating twitch username to a separate action #2784 (#2866)
* Move updating twitch username to a separate action #2784

* Fix the submit button on the integrations page

* Modify test according to the redirect
2019-05-24 11:13:33 -04:00
Clara
48b9d16e6e Bug/markdown underscores in usernames (#2948)
* Add method into MardownFixer and call in Comment

* Add test

* Escape all underscores in usernames and adapt tests

* Rework regex [WIP]

* Add new idea

* Clean up method and add correct tests
2019-05-24 08:34:14 -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
Mohammadjavad Raadi
1a960cfb44 Fix TwitterTag's video control bug (#2869) 2019-05-22 13:32:37 -04:00
rhymes
9e14ef2afd Add a proper exception in case of XSS attempt (#2927)
Fixes the generic error message with a proper one
2019-05-21 17:20:39 -04:00
Ben Halpern
07597d307c
Fix bug to allow users to remove org from article (#2930) 2019-05-21 17:16:16 -04:00
Jess Lee
27bd5ed4e2 add guard to granting credits and add spec (#2926) 2019-05-21 17:14:51 -04:00
Jess Lee
21f595ea2c Update Slack Notifications (#2870) [ci skip] 2019-05-21 15:06:04 -04:00
Ben Halpern
ae47e8db2c
Add API portal (#2915)
* Add API portal

* Change title tag
2019-05-21 12:46:52 -04:00