Commit graph

352 commits

Author SHA1 Message Date
rhymes
3b4bda89df Upgrade Honeycomb gem, fix and improve RssReader tests (#2319)
* Switch from deprecated honeycomb-rails to honeycomb-beeline

* Improve error handling, tests and add refactoring

* Fix multiple fetching test and add one more

The test wasn't actually testing the correct behavior, because the class
by default force fetches. It worked because it wasn't reloading the user
from the database.

* Test that Honeycomb's client is doing its thing

* Use some defensive programming to avoid any possible problem during shutdown

* Fix typo

* Use the new API to add fields to the current measured event

* Use default instrumentation and add user info to event

* Replace user.email with user.username, less personal data around

* Use mocking instead of calling Honeycomb.init

* Freeze time before traveling

* Remove a flaky test dependent on rand
2019-04-07 15:27:53 -04:00
Ben Halpern
5f3fd96960
Modify social share button and functionality (#2316)
* Modify social share button and functionality

* Some nightmode changes tossed in

* Style adjustments and test snapshot fix
2019-04-06 14:49:52 -04:00
Ben Halpern
42a5124fe4
Clean up videos page and add tests (#2315) 2019-04-05 16:05:50 -04:00
Jess Lee
175569fb97 "/videos" (#2291)
* set up video route

* add video index

* update styling

* fix mobile full width styling

* bust cache when new video is created

* add unlimited scrolling
2019-04-05 14:02:03 -04:00
Abraham Williams
b98565a931 Update rubocop to 0.67 (#2313) [ci skip] 2019-04-05 12:55:13 -04:00
Ben Halpern
d7e2a07064
Finalize suggest-a-tweet functionality (#2310) 2019-04-04 19:23:03 -04:00
Ben Halpern
1552df98d2
Add ability for trusted users to suggest social copy for posts (#2306)
* Add ability for trusted users to suggest social copy for posts

* Fix schema

* Fix tests

* Fix test
2019-04-04 17:01:58 -04:00
rhymes
5e9867ec56 Simplify AnalyticsService code (#2308)
* Add basic tests for Analytics service

* User/Organization are always required

* Add some data to the test

* Use queries and date times

* Fix AnalyticsService interface in the controller

* s/HTTP_API_KEY/api-key

* Defend against nils and support datetime objects

* Update app/services/analytics_service.rb

Co-Authored-By: rhymes <rhymesete@gmail.com>

* Use SQL sum, not Rails sum

* Group average_read_time

* Use SQL, not Rails

* Use ISO date

* Fix specs
2019-04-04 16:07:57 -04:00
Andy Zhao
3e89796d9d Add API Analytics Endpoints (#2293)
* Add API endpoints for analytics

* Remove comment and spacing

* Use proper time formatting

* Refactor and clean up some logic

* Add pro and org member traits

* Use shared examples for analytics API spec

* Add analytics authorization specs

* Remove accidental include Pundit

* Raise not_authorized for invalid requests

* Make attributes and time methods private

* Add custom UnauthorizedError

* Raise and use rescue_from to handle 4xx requests

* Enforce date parameters to follow a specific format

* Use current user to allow same origin requests

* Use custom headers and not params for token auth

* Default to current user for same origin requests

* Use correct boolean for choosing user

* Update tests to use request headers and add stricter tests
2019-04-04 10:52:45 -04:00
rhymes
3a53d5797e Upgrade Rails to 5.2.3 (#1408) 2019-04-03 13:08:59 -04:00
rhymes
dc2414c174 Add tests to PodcastEpisodesController (#2297)
* Add tests for existing API PodcastEpisodesController

* Generate only index route

There's no need to generate all routes if they are not implemented
2019-04-03 09:57:48 -04:00
Anna Buianova
1a0d4667c5 Unique twitter and github usernames #2061 (#2255)
* Set github and twitter usernames to nil if they are blank

* Verify github and twitter username in the Admin::UsersController (just in case)

* Add unique indexs on users twitter_username and github_username
2019-04-02 18:16:29 -04:00
Filip Defar
512c9ee8a0 Extract "followers" action from "show" in DashboardsController (#2270) 2019-04-01 18:43:44 -04:00
rhymes
c99fb27451 Add published in the SQL query to retrieve article (#2248)
Since we're already asking the DB to retrieve an article, we can directly ask it to filter out published articles without checking at runtime.
2019-04-01 06:24:17 -04:00
Anna Buianova
9c56e4413a Rubocop fixes (#2232)
* Enable ClassVars cop

* Enable Style/MultilineBlockChain cop

* Enable Style/SignalException

* Remove config parts matching with the default config

* Fix rubocop issue

* Moved cops that need to be fixed into the .rubocop_todo.yml
2019-03-28 07:35:17 -04:00
Filip Defar
7a3b16c1e5 Extract "following" action from "show" in DashboardsController (#2212) 2019-03-27 17:03:53 -04:00
Ben Halpern
d1e73dceba
Clean up new chat channel functionality and add tests (#2220) 2019-03-26 13:35:32 -04:00
Mario See
91968e3860 block/report abuse in dev-connect (#2074)
* block chat method

* block and report buttons

* styling

* more styling

* add id redirect

* remove whitespace

* authorize channel in block_chat method

* remove trailing whitespace

* make variable local

* validate using policy

* check channel direct

* fix comparison in chat_channel model

* fix channel variable
2019-03-26 11:53:30 -04:00
Filip Defar
88fc2a66d3 Remove /dashboard/following_users route (#2191) 2019-03-25 14:49:09 -04:00
Abraham Williams
9cb40e546b Enables Rails cops (#2186)
* Enable Rails cops

* Fix Rails/DynamicFindBy

* Fix Rails/HttpStatus

* Fix Rails/Blank

* Fix Rails/RequestReferer

* Fix Rails/ActiveRecordAliases

* Fix Rails/FindBy

* Fix Rails/Presence

* Fix Rails/Delegate

* Fix Rails/Validation

* Fix Rails/PluralizationGrammar

* Fix Rails/Present

* Fix Rails/Output

* Fix Rails/Blank

* Fix Rails/FilePath

* Fix Rails/InverseOf

* Fix Rails/LexicallyScopedActionFilter

* Add Rails/OutputSafety to TODO

* Add Rails/HasManyOrHasOneDependent to TODO

* Add Rails/SkipsModelValidations to TODO
2019-03-25 09:25:55 -04:00
Mike Coutermarsh
dd84051ce4 Social Card upgrade - Part 1 (#2090)
* Add HtmlCssToImage for generating images

This will be used by social_previews to convert the templates into images.

Setup a fallback image primarily for local dev, so that this won't cause
errors if authentication is missing.

Caching is setup to use contents of the html/css. So it with
autobust/generate a new image whenever the markup changes.

* Update Article social preview template to not be random

+ Being random breaks caching (since we generate cachekey by a SHA of html content)
+ Use Roboto for when generating via HTML/CSS to Image

* Update Tag social preview template to not be random

+ Make rand deterministic so it doesn't break caching

* Update user social preview template for html/csstoimage

* Update shecoded template to work with both url2png and htmlcsstoimage

* Add ability to respond to .png for social previews controller

When adding .png to the url, these routes will now generate an image and
redirect to it.

This leaves the existing pages as they were, so we're backwards
compatible with all the existing links out in the world.

* Fix merge conflicts

* Remove some duplication

* Improve spec descriptions/read better

* clean up setting template with a ternary
2019-03-22 16:28:02 -04:00
Jess Lee
1b0cb47916 Merge user and give pro users trusted role (#2176)
* remove pro privelges from other roles and add trusted role for pros

* add merge user routes and methods

* add specs

* add more specs

* update languauge on /internal for clarity

* fix code climate error
2019-03-22 16:20:31 -04:00
cyrillefr
a2fcbdc4a4 Enable performance rubocop cops (#2140) 2019-03-21 16:01:45 -04:00
Filip Defar
937bc63bbb Add list of followed organizations to dashboard (#2157) 2019-03-21 15:16:23 -04:00
rhymes
df2621a8c0 Implement image upload's error handling (#2018) 2019-03-21 12:31:51 -04:00
Tim Lange
3494264404 Enabled rubocop/lint (#2130)
* WIP: Enabled rubocop/lint

* FIX: Fixed failing test

* FIX: Small change to return

* FIX: Changed indent
2019-03-21 10:53:44 -04:00
rhymes
27213bf6da Use ActiveRecord::RecordNotFound instead of ActionController::RoutingError for 404s (#2118) 2019-03-19 20:54:25 -04:00
Edison Yap
7a0a793a89 Redirect to 404 if badge not found (#2066) 2019-03-19 16:04:43 -04:00
Ben Halpern
7bf37108b1
Night theme improvements + small fixes (#2114) 2019-03-19 13:36:30 -04:00
Ben Halpern
90a44b1687
Add prefill text for /new (#2108) 2019-03-18 19:08:00 -04:00
Jess Lee
9c1e10cd9f Improve Internal Dashboards features(#2043) 2019-03-18 16:29:11 -04:00
Ben Halpern
c901c7138d
Fix possible race condition with page view tracking (#2103)
* Fix possible race condition with page view tracking

* Change min number to check for html variant calculation
2019-03-18 15:53:13 -04:00
Andy Zhao
8a3d3ae765 Enable Org Pro Dashboard View (#2060) 2019-03-18 11:58:44 -04:00
Keshav Biswa
8d57d45ecc Rubocop Style cops enabled (#2056)
* Rubocop enabled style/alias

* Enabled Style/ArrayJoin Cop

* Enabled Style/Attr

* Enabled Case Equality

* Enabled CharacterLiteral

*  Enabled ColonMethodCall Cop

* Enabled CommentAnnotation cop

* Enabled PreferredHashMethods Cop

*  Enabled DoubleNegation Cop

* Enabled EachWithObject Cop

* Enabled EmptyLiteral Cop

* Enabled EvenOdd Cop

* Enabled IfWithSemicolon Cop

* Enabled Lambda and LambdaCall Cop

* Enabled LineEndConcatenation Cop

* Enabled ModuleFunction Cop;

* Enable NegatedIf and NegatedWhile Cop

* Enabled NilComparison Cop

* Enabled Not Cop

* Enabled NumericLiterals Cop

* Enabled OneLineConditional Cop

* Enabled PercentLiteralDelimiters Cop

* Excluded internal/users_controller from negated_if cop

* Reverted the double negation change from github_issue_tag and github_issue.rb"

* Enabled PerlBackrefs Cop

* Changed Regexp.last_match(1) to Regexp.last_match(0)

* Enabled proc cop

* Enabled RaiseArgs Cop

* Reverted Regexp.last_match(0) to Regexp.last_match(1)

* Enabled SelfAssignment Cop

* Enabled SingleLineMethods Cop

* Enabled SpecialGlobalVars Cop

* Enabled VariableInterpolation Cop

* Enabled WhenThen Cop

* Enabled WhileUntilModifier Cop

* Enabled WordArray Cop

* Enabled IfUnlessModifier Cop

* Enabled GuardClause Cop
2019-03-15 18:33:54 -04:00
Mario See
d8709c0334 Implement open inbox for dev-connect (#1563) 2019-03-15 14:39:57 -04:00
Ben Halpern
d6ab255a45
Allow users to configure to use night mode (beta) and sans-serif article body (#2072)
* Initial work for config

* Add config for users

* Fix schema
2019-03-15 13:11:53 -04:00
Anna Buianova
96de5a4f60 Don't send new follower notification when followable is a tag #2041 (#2050)
* Enable djs to confirm follow spec fail

* Don't send new follower notification when followable is a tag
2019-03-13 08:16:20 -07:00
Andy Zhao
4e120b8a8e Add more logging to sign in failures (#2038)
* Actually redirect when rescuing an error

* Use inspect to view class as string

* Use a slightly more descriptive flash message
2019-03-12 16:33:10 -07:00
Andy Zhao
1922a55739 Add initial charts implementation to pro dashboard (#2037)
* Refactor and optimize article ids a bit

* Add chartJS to package.json

* Add new queries for charts

* Add past week charts for rxns and comments

* Use real data oops

* Round followers percent to 2 decimals

Co-Authored-By: Zhao-Andy <andyzhao.zhao@gmail.com>

* Round all percentages to 2 decimals

Co-Authored-By: Zhao-Andy <andyzhao.zhao@gmail.com>
2019-03-12 10:21:12 -07:00
James Turner
a9254eac40 Fix typo in surrogate key header (#2013) 2019-03-11 17:40:45 -04:00
Ben Halpern
ecb9f6da3d
Remove some hardcoded shecoded stuff (#2011) 2019-03-08 18:08:48 -08:00
rhymes
3c6a7d4574 Display comment published timestamp according to user's locale (#1970) 2019-03-08 15:19:37 -05:00
Ben Halpern
27662eb924
Ben/shecoded tweaks (#2007)
* A few shecoded tweaks

* Refactor code
2019-03-08 08:16:10 -08:00
Ben Halpern
138278462a
Add shecoded sidebar/homepage decorations (#2003)
* Add shecoded sidebar/homepage decorations

* Add additional functioanlity to /shecoded

* Fix typo
2019-03-08 04:47:31 -08:00
Ben Halpern
8149a72efb
Nevertheless, She Coded (#2000) 2019-03-07 18:52:09 -08:00
Ben Halpern
825aa9be91
Add page_view model (#1985)
* Add page_view model

* Uncomment DJ routes

* Add time on site max and don't update article page views every time
2019-03-07 11:53:33 -08:00
Andy Zhao
5c116c4881 Update tag admin page(#1990) 2019-03-06 14:28:30 -05:00
Andy Zhao
d94f11fbf7 Add ability to add pro role to internal (#1980)
* Add ability to add pro role in internal

* Remove debug statement
2019-03-05 10:44:56 -08:00
Ben Halpern
e491cf1f65
Allow non-logged-in proper redirect for template posts (#1977) 2019-03-04 15:50:36 -08:00
Ben Halpern
b271e96965
Add shecoded social preview template (#1975) 2019-03-04 13:18:32 -08:00