Commit graph

675 commits

Author SHA1 Message Date
Molly Struve
2415392da5
Return a 401 Response when Github creds are bad via the API (#5249) [deploy] 2019-12-26 14:51:36 -06:00
Keith Bennett
3c980e7b83 Fix long line lints (#5062) 2019-12-26 13:24:24 -05:00
Molly Struve
faa4325c1f
Only Update page_views When They Are Valid (ie created) (#5195) [deploy] 2019-12-26 11:28:18 -06:00
Molly Struve
448adfdd23 Use ApiController for ChatChannels and return not_found error if channel cant be accessed by user (#5194) [deploy] 2019-12-24 13:12:29 -05:00
rhymes
2d6df70dea Return an empty result set instead of 404 in case users are not available. (#5238)
A common response in collection endpoint with REST APIs is to return an empty result set when the requested params end up in an empty result. The reason for this is that the resource itself exists (the collection always exists), it just is empty.

See https://github.com/thepracticaldev/dev.to/pull/5192
2019-12-24 13:08:10 -05:00
Molly Struve
36efb1b7bb Show count of users followed from API (#5229) [deploy] 2019-12-23 18:20:39 -05:00
Ben Halpern
03c2404b13
Redo /mod for performance and usability (#5230) [deploy] 2019-12-23 18:10:25 -05:00
Ben Halpern
cb3a0c462c
Separate chat channel unopened status from Algolia (#5198) [deploy] 2019-12-21 13:05:16 -05:00
Molly Struve
212a2a430d Return not_found response if we cant return users via the api (#5192) 2019-12-20 13:43:14 -05:00
Sarthak Sharma
b602b7b91f 🚀Feature/ability to edit messages (#5139) [deploy]
* Feature 🚀 : Ability to delete messages in chat channels

- Sending message ID to frontend
- Deleting Message
- Use pusher to delete message realtime

* Minor Bug 🐞: Show message action only for current user

- User can delete or edit their own messages

* Test cases added

* Bug 🐞: Update message id for receiver

Message id was not sent to receiver by pusher

* Refactoring🛠: Message controller refactoring

* Test Cases📝 : Specs for Delete message added

* Feature 🚀 : Ability to edit messages

* Test Cases📝 : Specs for Edit message added

* Refactoring🔩: Refactoring for edit messages

* Refactoring🔩: Refactoring:2 for edit messages

* Refactoring🔩: Refactoring:2 for edit messages

* Test Cases📝 : Test Cases for edit message added

* Minor Bug 🐞: Show message action only for current user

- User can delete or edit their own messages

* Test cases added

* Bug 🐞: Update message id for receiver

Message id was not sent to receiver by pusher

* Feature 🚀 : Ability to edit messages

* Test Cases📝 : Specs for Edit message added

* Refactoring🔩: Refactoring for edit messages

* Refactoring🔩: Refactoring:2 for edit messages

* Refactoring🔩: Refactoring:2 for edit messages

* Bug Fix 🐞: Added space between edited and timestamp

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2019-12-20 10:19:00 -05:00
Molly Struve
1b2cdfb0c4 Return 422 if params are missing when creating an article via the API (#5182) 2019-12-19 19:21:21 -05:00
Molly Struve
f26a6f49d2 Revert "Use raw SQL to Update page_views so new and existing Records can be updated (#5167) [deploy]" (#5185)
This reverts commit 9a7fb3b04e.
2019-12-19 16:43:37 -05:00
Molly Struve
9a7fb3b04e
Use raw SQL to Update page_views so new and existing Records can be updated (#5167) [deploy] 2019-12-19 14:28:32 -06:00
Molly Struve
ac8e5b4fb0
Return not_found error if org is not found (#5179) [deploy] 2019-12-19 10:53:50 -06:00
Molly Struve
36aed0458e create social preview for comment that is missing commentable (#5171) [deploy] 2019-12-19 11:14:37 -05:00
Molly Struve
4a2e55ff06
Return not_found Response If Video's Related Article is Not Found (#5169) [deploy] 2019-12-19 09:41:59 -06: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
Anna Buianova
dcfa6d29b8 Fix Rubocop lints (#5155) 2019-12-19 10:09:37 -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
Molly Struve
1a76fa03d7 Return ActionController::RoutingError error when Invalid Format is Requested (#5140) [deploy]
* Return ActiveRecord::RecordNotFound error when an invalid format is requested

* raise ActionController::RoutingError when template is not found
2019-12-17 10:00:12 -05:00
Ben Halpern
7684c1e8b9
Add edge caching to shell (#5146) [deploy]
* Add edge caching to shell

* Add tests for shell
2019-12-16 19:08:59 -05:00
Ben Halpern
07a7e9c075
Monkeypatch method to ensure https redirect (#5145) [deploy] 2019-12-16 18:15:14 -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
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
Molly Struve
d6e513e1ac Default return all user notifications if filter is unknown (#5103) [deploy] 2019-12-13 14:35:53 -05:00
Spencer
82f5bb9cdd Mod tooling: add tags via /mod refactor (#5017)
* mod view form changes

* add error validation for removal tag

* add error validation to tag_list count

* re-render tag_adjustment form errors

* refactor admin delete adjusted tags form

* add prompt to tag adjustment form select

* front end validations to add/remove tag_adjustment

* allow tag_mod to undo own tag adjustment

* update/add specs

* update send spec

* update tag adjustment spec
2019-12-13 13:02:45 -05:00
Molly Struve
aa9361798d
Return not_found response rather than trying to authorize a nil object (#5093) [deploy] 2019-12-13 09:39:40 -06:00
Jacob Herrington
b34ae9b7d9 Remove dead code (#5090) [deploy] 2019-12-12 12:19:55 -06:00
Molly Struve
dc5ec4e52f
Use find_or_create_by to avoid duplicate records (#5092) 2019-12-12 12:01:15 -06:00
Molly Struve
6ba2853168 Ensure that we have a slug and owner before attempting to lookup an article (#5079) 2019-12-11 13:19:45 -05:00
Jacob Herrington
145db47a3a Add single resource admin concept (#5069) [deploy]
* Add a trait for single_resource_admins to users factory

* Add single_resource_admin authrization for Growth view

* Expand GrowthController test coverage

* Add single resource admin workaround to models

* Add single resource admin to additional views
2019-12-11 13:17:55 -05:00
Molly Struve
2d6d611634 switch back to update_column to improve performance (#5074) [deploy] 2019-12-10 18:38:04 -05:00
Andy Zhao
71157c993e Hide comment feature (#4944)
* Add MVP of hide comment feature

* Slight copy adjustments

* Remove unused file oops

* Fix strange styling issues

* Add hide/unhide comment specs

* Authenticate user for hide/unhide

* Add tests for hide/unhide functionality

* Remove opacity CSS for hidden comments

* Fix hidden comment explanation logic

* Fix some styling issues

* Fix hiding top level comment logic

* Show only hidden comments in permalink and not thread

* Hide subtree properly if hidden comment

* Fix weird CSS issue

* Properly hide comments for permalink view

* Show children comments in permalink view

* Add tests for comment hiding visibility

* Remove superfluous code and adjust copy

* Remove some more logical duplication

* Add dedicated article column for any comments hidden

* Add reload in test
2019-12-10 15:09:47 -05:00
Molly Struve
98b832155f Ensure remember_user_token is present for Fastly with specs (#5065) 2019-12-10 15:01:26 -05:00
Molly Struve
3f8a6caa72
Use find_or_create_by when updating a pageview and use update in case of creation (#5066) [deploy] 2019-12-10 13:48:50 -06:00
Molly Struve
7c650dcb1c
Remove RedisRailsCache and replace with Rails.cache (#5059) [deploy] 2019-12-10 13:11:08 -06:00
Sarthak Sharma
4db5399ee8 Feature🚀: Ability to Delete Messages realtime (#5056)
* Feature 🚀 : Ability to delete messages in chat channels

- Sending message ID to frontend
- Deleting Message
- Use pusher to delete message realtime

* Minor Bug 🐞: Show message action only for current user

- User can delete or edit their own messages

* Test cases added

* Bug 🐞: Update message id for receiver

Message id was not sent to receiver by pusher

* Refactoring🛠: Message controller refactoring

* Test Cases📝 : Specs for Delete message added
2019-12-10 13:58:34 -05:00
Molly Struve
834eb51e98
Replace Airbrake with Honeybadger (#5007) [deploy] 2019-12-05 11:29:51 -06:00
Sarthak Sharma
147b0936df Feature🚀: Ability to see chat history by scrolling up (#4903)
* Feature🚀: Ability to see chat history by scrolling up

* Test samples updated

* Feature Enhancement 🛠 :  Jump back to recent messages

If you scroll far away just click this button to go back

![img](https://i.imgur.com/HlhB8Up.gif)

* Test case added

* Bug Fix 🐞: Scrolling problem with large screen and re-rendering issue
2019-12-03 15:19:04 -05:00
Ben Halpern
585d672742
Replace serviceworker-rails gem with custome implementation (#4987) [deploy]
* Customize UserContext in Timber logs

* Replace serviceworker-rails gem with custome implementation
2019-12-03 08:50:56 -05:00
Molly Struve
247833a952 Remove unused giveaways code (#4989) [deploy] 2019-12-02 15:23:28 -05: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
5bcdeb5162
Fix black-on-black etc. buttons and update social preview cards (#4954)
* Fix black-on-black etc. buttons and update social preview cards

* Change up font family details

* Fix org badges

* Adjust fonts for user name

* Add roboto to font stack

* Adjust gradiant
2019-11-28 09:39:07 -05:00
Ben Halpern
b938dab91b
Add ApplicationMetalController to relevant controllers (#4937)
* Add ApplicationMetalController to relevant controllers

* Add request forgery protection to metal

* Remove logger call

* Add logger keyword and skip protect_from_forgery in test

* Uncomment main_image in test
2019-11-26 16:29:07 -05:00
Ben Halpern
eaf6ea2f4b
Update pageviews count less often in page_views_controller (#4945) [deploy] 2019-11-26 14:11:47 -05:00
Molly Struve
3be406290a
Store FollowChecker responses to Avoid Multiple db Hits (#4886) [deploy] 2019-11-26 13:03:19 -06:00
rhymes
0ffa127481 Refactor session_current_user_id in a shared concern (#4936) 2019-11-26 13:21:56 -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
Molly Struve
091392cf1f Remove webpush gem and code (#4883) 2019-11-22 16:46:11 -05:00
Ben Halpern
36479f09c3
Replace current_user.id with session_current_user_id (#4880) [deploy]
* Replace current_user.id with efficient_current_user_id in high-leverage areas

* Update name of efficient_current_user_id

* Replace user_signed_in? in pageviews

* Remove unneeded ?
2019-11-22 14:27:43 -05:00