Commit graph

85 commits

Author SHA1 Message Date
Anna Buianova
f675b8e4fc
A couple of rubocop fixes (#6648) 2020-03-16 16:15:52 +03:00
Michael Kohl
02f86fedd7
Allow admins to delete users without emails (#6530) [deploy]
* Allow admins to delete users without emails

* Guard against blank email addresses
2020-03-10 22:20:36 +01:00
Michael Kohl
183c24ca59
Show hidden comments on article mod page (#6493) 2020-03-06 16:12:07 -05:00
Josh Puetz
6d7cbfff1f
Restore featured story on timeframe pages for logged out users (#6427) [deploy]
* Restore featured story on timeframe pages for logged out users

* Handle arrays and empty collections when finding featured article
2020-03-04 08:01:24 -06:00
Fernando Valverde
5bb9890c09
Adds administrate gem CSS & JS assets to Sprockets Manifest (#6291) [deploy]
* Adds administrate gem application.css & applicatiion.js to Sprockets manifest

* Adds admin tests
2020-02-26 09:21:09 -06:00
Jacob Herrington
42042d9a9e
Vomit on users from /mod (#6182) [deploy]
* Add UI to vomit on a user from /mod

Co-authored-by: MichaelaHunter <michaela1234@gmail.com>

* Add backend tweaks for vomitting on users

Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com>

* Validate that users can't moderate articles

* Add system spec for article mod page

* Satisfy rubocop after rebase

* Fix typo and formatting

* Use reactable_id instead of user_id

Co-authored-by: Michaela Hunter  <60361569+MichaelaHunter@users.noreply.github.com>
Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com>
2020-02-20 14:11:53 -05:00
ludwiczakpawel
a77dfefc2a
Homepage UI Improvements (#5890) [deploy]
* de-emphasizing right sidebar: mostly colors & spacing

* adding a bit more love to typography in sidebar

* changing language on LISTINGS widget header

* hiding profile widget from left sidebar

* cards shadow now looks like a bit less random and annoying

* actually doing the same with all shadows! YOLO

* some spacing cleanups around sidebars

* this time some typography love

* im committing but not really sure what exactly

* adding a bit more love to feed card

* looks like i broke some other views.. time to fix em all

* cleaning up typography a bit more

* .

* separating empty search results styling

* created a card styling mixing to reduce some code.. also moved cheese around a bit

* several more cleanups

* improving responsiveness

* i fixed what i broke

* more cleanups

* org badge

* .

* ...

* responsiveness

* .

* some adjustments

* bring back profile card

* tiny logo adjustment

* bunch of further refainments

* typography

* a bit more refainments

* whoops

* bringing back CTAs styling to loggedout sidebar

* fixes to left tags in left sidebar after merge

* buttons fix

* fixing border-color

* Update app/assets/stylesheets/articles.scss

Typo!

Co-Authored-By: Nick Taylor <nick@iamdeveloper.com>

* .

* css cleanup + double border on article page

* removing unnecessary comments

* get rid of loading glitch

* static vs fixed header

* Update system specs

* Update client test snapshots

* Further modify homepage specs

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-02-19 11:24:44 -05:00
Josh Puetz
38622317b7
Consolidate server side main article feed logic (#5953) [deploy]
* Consolidate `.decorate` calls

* Move Activerecord finders out of main stories feed partial

* Add back in decorates to sticky_articles partial

* Combine top and new articles returned from StoriesController

* Extract feed construction logic to a service

* Some PR tweaks (naming)

* Quick test fix
2020-02-12 08:43:20 -06:00
Nick Taylor
0119918237
Homepage left side bar tags followed (#5918) [deploy]
* SASS formatting in action.

* Unnested .sidebar-nav-element in SASS

* Created the <TagsFollowed /> component.

* Mini refactor.

* Left side bar uses <TagsFollowed /> component now.

* Accomodating InstantClick

* Small refactor and added some comments.

* The homepage webpacker pack only needs to be loaded once.

* Added tests for the <TagsFollowed /> component.

* Modified the receive InstantClick callback as per their docs.

* Reverted the data-no-instant on he homepage bundle. It seems to cause issues in certain scenarios.

* Just some tweaks to <TagsFollowed /> component.

* Removed CSS for general img tag in context of sidebar as it does not appear to be used.

* Fixed copy paste error from JSX to HTML.

* Fixed <img /> styles for arbitrary sponsorship widget.

* Fixed a regression that a Capybara test caught.

* Fixed user followed tags on home page tests.

* Fixed logic for loading user data on homepage.
2020-02-11 12:09:23 -05:00
rhymes
c41d66e900
Replace ban/banned with suspend/suspended in user facing text (#5816) [deploy] 2020-02-10 10:12:53 -05:00
Vaidehi Joshi
c7a1bd9449
Fix logging for dev and test environments (#5922)
* Fix logging for dev and test environments

We had some unused code for Timber in our config files for development and test.
However, this was completely clobbering Rails' default behavior of logging out to log/development.log and log/test.log. We should allow for logging in these environments in particular, and since we're not using Timber there, we can just revert to using the Rails default debugging log levels.

* Add Timber logger to specs that explicitly require it

* Restore default Rails.logger in specs using Timber logger

* Explicitly use Rails.logger in OmniauthCallbacksController

We seem to have different logger classes leaking into this controller in tests.
I'm not entirely sure why this is/haven't been able to investigate yet, but I do think we should be using the Rails.logger explicitly until we can figure that out.
2020-02-07 10:15:08 -05:00
Michael Kohl
7270d5ab4c
Move user deletion by moderator to worker (#5887) [deploy] 2020-02-05 08:27:07 -05:00
Vaidehi Joshi
267e08f6f0
Improve dropdown UX for internal/badges (#5880) [deploy]
* Improve dropdown UX for internal/badges

Add a "blank" option to the dropdown to list of badges on internal/badges route.
Also add some checks to handle if an admin accidentally tries to award a "blank" badge.

* Ensure error is surfaced as flash message
2020-02-04 09:02:14 -08:00
Alex
783da4b0d5
Move BadgeAchievements::SendEmailNotificationWorker to Sidekiq (#5779) [deploy] 2020-01-31 14:45:32 -05:00
Sebastien
a25446b1d4 Add organizations to user profile (#5583) [deploy]
* Add organizations to user profile

* Add user organization info updated at column and cache key

* Remove default value for users organization_info_updated_at column

* Update organization_memberships factory

* Remove schema organization_info_updated_at default value

Co-authored-by: rhymes <rhymesete@gmail.com>
2020-01-27 13:31:27 -05:00
Maykon Menezes
7ad7320add Worker/user self delete (#5698)
* Moving user self delete job to sidekiq

* Refactor/user self delete worker
2020-01-27 08:45:58 -05:00
Anna Buianova
01456fe029 [deploy] Finalize deleting user associations (#5624)
* Prepare factories and associations for Users::DeleteActivity specs

* Altered user associations, delete the needed associations in Users::DeleteActivity

* Moved and refined user deletion spec

* Removed useless commented user associations

* Refactored BackupData factory

* Refactored ProfilePin factory

* Refactored Reaction factory

* Fixed specs: Keep default _type in factories or specify it in tests

* Ok, notes shouldn't be deleted on user deletion

* Fixed creating reactable for specs

* Specify commentable/commentable_type explicitly when creating data for tests

* Fixed typo in the comments spec

* Removed unnneeded space

* Added aggregate_failures for testing user associations deletion

* Keep feedback_messages while deleting user activities
2020-01-23 11:29:47 -05:00
Ben Halpern
46a0742d85
Remove flaky edit button spec (#5579) 2020-01-18 20:32:21 -05:00
Jacob Herrington
8db4808d2e Internal Reports: Searching and sorting with Ransack (#5447) [deploy]
* Add gem Ransack 2.3.0

* Add sorting and search to internal/reports

The UI here should probably be revisited sooner or later, I feel like
the vomit reactions might even need to be moved to their own view.

* Add system spec for internal reports search

* Remove filter for report_type
2020-01-16 15:02:09 -05:00
Molly Struve
29efdaf20a
Remove Comments::CreateIdCodeJob which is now done inline (#5536) 2020-01-16 09:31:11 -05:00
Jenna Pederson
5c9302f5f1 Migrate subscribe to mailchimp newsletter job to sidekiq worker (#5423)
* Start migrating job to sidekiq worker
* Only check for badge jobs queued to sidekiq
2020-01-10 08:43:13 -06:00
Cadu Ribeiro
00a97b2051 Migrate Users/FollowJob to Sidekiq (#5403) 2020-01-08 15:03:18 -05:00
rhymes
fec196ffe3 Add wait_for_javascript to flaky system tests (#5405) 2020-01-08 13:47:08 -05:00
Molly Struve
64ca1e7638
Set type for user_selects_looking_for_work_spec to system (#5390) 2020-01-08 12:16:33 -05:00
serena
252027ad9c use new_badge_achievement_worker instead of active job (#5358) [deploy] 2020-01-07 08:16:17 -05:00
Molly Struve
39033e33d9 Flaky Spec Fix: Ensure submit requests finish before checking status of user (#5265) 2019-12-27 14:47:08 -05:00
Molly Struve
b1a71d0ac1 Ensure comment has a path when created for specs (#5197) 2019-12-20 17:23:59 -05:00
Molly Struve
71fbad5387 Check user follow count after job is run (#5193) 2019-12-20 14:25:58 -05:00
Jacob Herrington
00dd84f9e1 Add a default message to badge award action (#5160)
* Add a default message to badge award action

Because:
 - The only badges routinely awarded manually use the same message
 - Right now, unfriendly/unsafe UI can result in an error notification

The only badges that are currently awarded manually (afaik) have the
message "Congrats!!!" so for the time being, if a message is not
supplied to the UI, it will simply use the "Congrats!!!" message as a
default.

That being said, I'm not totally convinced this message won't work for
the long term. Generally, if we are awarding badges by hand, I'd imagine
we'd want a specific message explaining why we are doing that, or just
be okay with "Congrats!"

After talking with Peter about it, the longer term goal should be to
move badge messages into the database so they can be modified in the app
and not hardcoded. That also make sense regarding the effort to
genericize the app eventually.

* Test Badge notifications
2019-12-19 10:38:57 -05:00
Jacob Herrington
d98f8237bd Add view for managing organizations (#5149) [deploy]
* Add view for managing organizations

This adds only an index and show action for the internal/organizations
page. Eventually we'll flesh this out with features to automate the more
mechanical org management tasks.

* Use instance variable for search query

* Convert multiple expects into one

* Add pagination to organizations

* Add search spec for organizations

* Use size over count
2019-12-17 12:07:11 -05:00
Ben Halpern
630c1b7425
Migrate to streaming app shell via serviceworkers (#5020) [deploy]
* Initial work for streaming app shell way of using serviceworkers

* Close in on serviceworker adjustment finalization

* Add docs and loading indicator

* Remove useless code

* Don't run on API

* Update app/javascript/contentDisplayPolicy/hideBlockedContent.js

* Fix small details

* Don't run serviceworker.js code in test env

* Fix JS in serviceworker

* Move private keyword to proper place in async controller

* Change shell_version to HEROKU_SLUG_COMMIT

* Update caching config

* Add test for async_info/shell_version
2019-12-16 12:21:33 -05:00
Keith Bennett
70e1ffbbc3 Fix rubocop Rails.root.path complaints (#5114) 2019-12-16 12:13:15 -05:00
Jacob Herrington
35ede32be7 Internal bulk badge awarder (#5110) [deploy]
* Move admin specs

These tests should probably be grouped together, so I moved them into a
directory called "internal"

This also encourages some additional internal tests.

* Add an internal badges controller

* Add internal view for running BadgeRewarder task

Because:
  - Peter is currently running this rake task from Heroku and this is
  going to make his workflow easier
  - It's a step towards having a decent tool under internal for managing
  badges (though I'd hesitate to call this decent)

This change adds a view and controller action to award badges in
batches, it's an improvment over the current workflow that Peter is
using, but it's still very rough around the edges.

We could definitely improve this with some error handling around the way
the BadgeRewarder works, but for now this is a net gain over how Peter
has been doing this task. I think it's worth merging as is and future
work to improve the experience and reliability of this tool can be
prioritized against other tasks.
2019-12-16 11:31:37 -05:00
Jacob Herrington
ff32ed853f Remove commented specs (#5096) [deploy]
* Remove comment spec with no examples

* Delete commented out spec

This test could be refactored to a green state, but I'm not sure it's
worth the effort.

I started down that path, but it was time consuming. It might be more
effective to rewrite this test from scratch.

For the time being, since it has not been running, I think it should be
removed from the codebase.
2019-12-13 08:26:31 -05:00
Jacob Herrington
df776b8748 Fix pending tests (#5070) [deploy]
* Enable pending system spec

* Remove pending and useless tests

There is a pending test for functionality that does not exist, so I
removed it.

I removed some expect blocks that were essentially testing if Rspec
works / if Rails routing works. That's probably not necessary for us to
do and leaving the code in a spec encourages future contributors to
write similar specs.
2019-12-10 15:10:14 -05:00
Molly Struve
7c650dcb1c
Remove RedisRailsCache and replace with Rails.cache (#5059) [deploy] 2019-12-10 13:11:08 -06:00
Anna Buianova
cfd5434d6c User deletion by email (#4863) [deploy]
* Action to request account deletion by email

* Confirmation page for user destroy

* Remove some of the old destroy user code

* System tests for user destroy

* Moved user destroy tokens to redis

* Change tests according to the new user destroy token storage (in redis)

* Added info about the link to user delete confirmation email

* Remove blank like from schema.rb

* Delete user destroy token on user delete

* Update confirm user destroy js
2019-11-29 13:47:11 -05:00
Ben Halpern
befefd08d0
Remove extra dependencies for PageViewsController (#4923) [deploy]
* Remove extra dependencies for PageViewsController

* Fix strongparams and fix typo

* Fix spec

* Remove unnecessary page_view param

* Remove additional unnecessary page_view

* Create ApplicationMetalController for shared Metal behavior

* Revert rand numbers to ensure apples-to-apples perf compare

* Whoops, revert change revert

* Clarify comment
2019-11-25 19:06:34 -05:00
Jacob Herrington
d2112adcbf Delete a commented out system spec (#4905)
This test was commented out, but I don't see much information in the
commit message as to why. The Pull Request which this commit was merged
from seems to be lost as well.

This test does seem to pass when it's not commented out, but there must
have been a reason it was commented out.

That being said, the test isn't really *testing* much functionality.
Essentially, it just asserts that a page with the word "settings" on it
renders from several different approaches. This might be problematic
because a false positive would be quite easy.

In light of those things, it makes sense to me that this test should be
removed.
2019-11-25 08:20:13 -05:00
Jacob Herrington
10426fbef5 Delete a commented out test (#4875) 2019-11-21 15:14:12 -05:00
John Curcio
157a6f1ef1 Add pagination to followers and following page in dashboard (#258) (#4375) [deploy]
* Add infinite scroll to followers list (#258)

* Refactor fetchNext function for clarity (#258)

* Sepparate following tab into multiple tabs to support infinite scroll (#258)

* Add infinite scroll to following pages (#258)

* Add tests to infinite scroll api

* Refactor dashboard loading text

* Refactor infine scroll function

* Fix duplicated entries problem in infinite scrolling

* Switch randomized attributes to sequential to avoid InvalidRecord error

* Add acceptance tests for infinite scroll

* Remove unused following method

* parameterize limit per page for followers and followings

* Split follows endpoint into followers and followings

* Authenticate user with api key in followers and followings

* Split followers endpoint into users and organizations

* Add redundant html to sublist partial

* Speed up infinite scroll tests

* Refactor api json responses to use partials

* Authenticate api user before follows create

* Resolve conflicts on scrolling js

* Improve partials organization and fix organization username bug

* Improve readability of unauthorized test

* Use let! to create scrolling test data

* Fix not working podcasts link

* Refactor initScrolling to remove linting errors

* Fix codeclimate coding style issue

* Test tags forms and podcasts hyperlinks

* Fix eslint issue with double equals

* Improve before_action usage and readability
2019-11-20 18:21:18 -05:00
Keith Bennett
b9069a2feb Simplify sort tests in user_sorts_dashboard_articles_spec.rb (#4841) [deploy]
* Simplify sort tests.

* Rename some identifiers.
2019-11-18 18:52:30 -05:00
Anna Buianova
8c58be75f5 Self-deleting user account (#4480) [deploy]
* Start with self deleting account

* Moved deleting user content and activity out of moderator hierarchy

* Added tests for the users delete services

* Tests for Users::DeleteComments

* User self-deletion (start)

* Some tests for user self-delete

* Specs for user self-deletion

* Test flash settings on users delete

* Added basic specs for the Users::DeleteJob

* Send notification when a user was destroyed

* Rename Users::DeleteJob to SelfDelete

* Change texts about self-deletion

* Fix users delete job spec

* Rescue and log exceptions while self-deleting user

* Added visible flash notices after deleting user

* Remove unneeded css for flash notice

* Fix link to a ghost account

* Remove redundant css

* Added github and twitter oauth apps links
2019-11-11 14:59:01 -05:00
Fabbri Paolo
89e893f157 Fix rubocop detected offenses (#4552)
* Run Inspecting 1050 files
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.....................................................................................................................................................................................................................................................................................................

Offenses:

spec/models/article_spec.rb:195:7: C: RSpec/NestedGroups: Maximum example group nesting exceeded [4/3]. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups)
      context "when description is empty" do
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1050 files inspected, 1 offense detected to fix autofixable errors

* Refactor  to correct test

it was braking the rule RSpec/NestedGroups: Maximum example group nesting exceeded [4/3]. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups)

* Run `rubocop --auto-gen-config` to regenrate `.rubocop_todo.yml`
2019-10-24 11:53:03 -04:00
Akshay Arora
9b5f57db0e Fixed Leave organization not working (#4387) (#4420)
* Fixed Leave organization not working

* Added named route for users_leave_org
2019-10-15 18:04:16 -04:00
Duc Nguyen
2ebe70039a Feat: #3498 Display episode's published_at (#4272)
* feat: #3498 Display episode's published_at

* feat: #3498 Move methods to decorator

* feat: #3498 Add check if published_at present

* feat: #3498 Add testcase for showing published_at

* Fix build failure #3498

https://travis-ci.com/thepracticaldev/dev.to/builds/130734935

* feat: #3498 Fix testcase failed on Travis 130738295

* feat: #3498 Address comments on PR #4272

* feat: #3498 Delete unused

* feat: #3498 Refactor the use of decorate
2019-10-08 17:06:46 -04:00
John Curcio
432d3348f6 Move user.follow delay calls to ActiveJob (#3136) (#4203)
* Move user.follow delay calls to ActiveJob (#3136)

* Pass ids to follow job instead of active records
2019-10-03 11:22:00 -04:00
Ben Halpern
8d40f54a31
Add initial functionality for Stackbit on integrations settings tab (#4113)
* Add initial functionality for Stackbit on integrations settings tab

* Add test for stackbit integration

* Adjust test

* switch check from grants to tokens
2019-09-26 07:29:28 -04:00
rhymes
c8abbe9d60 Pro: memberships (#3461)
* Add ProMembership model

* Implement ProMembershipsController#create

* Implement basic ProMembershipsController#show

* Add ProMembership to ledger

* Populate user history after pro subscription is created

* Add fields for expiration notifications

* Add ProMemberships::ExpirationNotifier to notify users of expiring memberships

* Add tasks for recurring jobs to notify users of expiration

* Add auto_recharge column to ProMembership

* Add ProMemberships::Biller (incomplete)

* Fix specs

* Add ProMembership to Administrate

* Fix spec

* Add has_enough_credits? to User and Organization

* Add Payments::Customer class

* Finish ProMembership::Biller functionality

* Fix ProMemberships::Creator check for credits

* Disable destroy actions for ProMembershipsController

* Correctly authenticate ProMembershipsController actions

* Make sure only pro user's history can be indexed

* Add ProMembershipsController#update action for auto recharge

* Use regular AR to save new credits and add touch to the purchaser

* Clarify Pro membership create policy

* Display information about an existing pro membership

* Add UI to show page

* Add system test for Pro membership creation

* Implement edit membership

* Make sure users with pro memberships can access history and dashboard pro

* Fix padding issue

* Show a different text for a user that has credits but not enough for Pro

* Move Pro Membership functionality inside settings

* Update Pro Membership link in email notifications

* Bust all relevant caches

* Add the Pro checkmark around the website

* Use Users::ResaveArticlesJob instead of delay

* Add/remove user from pro-members chat channel

* Use the appropriate Pro checkmark

* Remove unfinished pro elements

* Remove checkmark JS
2019-09-24 10:38:54 -07:00
Mac Siri
5fba3bd4b9
Improve test speed (#3957) [ci skip] 2019-09-12 16:17:20 -04:00