Commit graph

115 commits

Author SHA1 Message Date
Anna Buianova
1b9f2432f6 Conditional validations for user github_username and twitter_username #2061 (#2312)
* Conditional validation for usernames

* Allow nil, not blank for usernames
2019-04-05 11:35:26 -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
Anna Buianova
75a977172c Fix notifications about the new child comments (#2233) 2019-03-29 12:51:10 -04:00
Anna Buianova
4b02fe87a4 Optimize sign in: Identity #2061 (#2231)
* Add unique index to identity

* Conditional uniqueness validations on identities

* Remove redundant Identity specs
2019-03-28 16:10:23 -04:00
Anna Buianova
e1968e815b Extract new reaction notification to ActiveJob (#2122) 2019-03-25 13:54:21 -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
Ben Halpern
7f27aa32c7
Add areas for DEV Shop displays on left sidebar (#2162)
* Add areas for DEV Shop displays

* Update display_ad spec

* Add organization to spec

* Add orgs to specs properly
2019-03-22 09:57:37 -04:00
cyrillefr
a2fcbdc4a4 Enable performance rubocop cops (#2140) 2019-03-21 16:01:45 -04:00
Abraham Williams
9c55121dcc Update deprecated Faker::Overwatch use (#2142) [skip ci] 2019-03-21 12:17:16 -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
Anna Buianova
f0e9c0cfef Extract sending new follower notification to a separate job (#2030) 2019-03-20 12:51:09 -04:00
Ben Halpern
91bd6322ad
Add organic page view sums and modify seo boostables (#2109)
* Add organic page view sums and modify seo boostables

* Add score minimum for SEO boostable
2019-03-19 09:32:26 -04:00
Anna Buianova
825128edc4 Fix reaction notification json data when a reaction is destroyed (#2112)
* Add specs for notification sending when a destroyed reaction is passed

* Keep only persisted reactions data in the notification
2019-03-19 08:34:24 -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
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
Anna Buianova
0ac8eb1f73 Make less queries when displaying articles flare tags (#1957)
* Make less queries when displaying flare tag

* Make less sql queries to display articles flare tags
2019-03-05 07:27:51 -08:00
Andy Zhao
8b8dbd0172 Add Milestone Notifications (#1920)
* Test milestone notifications

* Add initial milestone notifications

* Add extra milestone goalposts

* Move send reaction milestone

* Use proper twilio-video package version

* Add random giphys gifs to milestones

* Make images responsive and add addl gifs

* Add guard statement for older articles

* Update app/views/notifications/_milestone.html.erb

Link to Giphy page instead of source page

* Generate gifs via class and factor in aspect ratio

* Add border radius to gifs

Co-Authored-By: Zhao-Andy <andyzhao.zhao@gmail.com>
2019-03-01 12:25:45 -08:00
Ben Halpern
532903c688
Add experience level averaging to articles (#1922)
* Add experience level averaging to articles

* Adjust copy on /mod ratings page
2019-02-28 08:17:29 -08:00
Ben Halpern
59cf1e5852
Add missing CloudinaryHelper inclusion in HtmlVariant (#1923)
* Add missing CloudinaryHelper inclusion in HtmlVariant

* Add test
2019-02-28 06:57:05 -08:00
Anna Buianova
8d60177d45 Remove old methods from reactions #1621 (#1924)
* Remove old methods from reactions

* Return the needed Reaction methods
2019-02-28 06:50:29 -08:00
Anna Buianova
875114395c Fix delayed job errors related to reactions #1621 (#1883)
* Add delayed_job_web to dev environment for debugging

* Add specs for the current Follow callbacks implementation

* Move follower touching to ActiveJob

* Spec for the touch followers job

* Move Follow#create_chat_channel to ActiveJob and make the job safe

* Add ActiveJob to send email notifications about follows

* Enqueue SendEmailNotificationJob after the follow is created

* Specs to wnsure jobs are enqueued on Follow creation

* Make CreateChatChannelJob queue name more specific

* Reaction specs for Reaction after_save callbacks logic

* Touch user job

* Call Users::TouchJob on reaction create

* Move updating reactable to a separate job

* Move busting reactable cache to a separate job

* Bust homepage cache after reaction save in a separate job

* Spec for enqueueing Users::TouchJob on reaction create

* Refactor Reactions::UpdateReactable job

* Fix observer spec
2019-02-27 16:19:01 -08:00
Alexander
a1b5dfbe89 Add test for validation badge image (#1909) [ci skip] 2019-02-27 10:45:13 -05:00
Andy Zhao
5ace9a5fc9 Organization Notifications (#1762)
* Add spec for org reaction notification

* Add organization_id to notifications

* Add validations for user and org IDs

* Move comment json_data out of loop

* Use actual column names instead

* Add organization filters

* Remove extra text-align

* Add organization filtering

* Refactor to reduce complexity

* Add receiver argument to handle orgs

* Add has_many notifications for orgs

* Add follow notifications for orgs

* Add comment notifications for orgs

* Rename some tests for specificity

* Add mark org notifications as read functionality

* Add radix to parseInt

* Define json_data outside of loop

* Notify org followers of a new post as well

* Move test to proper location

* Add test for aggregated method

* Make send org reaction notification more readable

* Test the rest of the notification model

* Refactor tag adjustment spec

* Fix extra html
2019-02-25 14:25:37 -08:00
Anna Buianova
e45c61a308 Bust cache on article destroy instead of resave articles #1621 (#1801)
* Bust cache on article destroy instead of resave articles

* Change articles delayed job queue
2019-02-23 19:41:06 -08:00
Anna Buianova
58b2013377 Fix delayed job errors related to follows #1621 (#1835)
* Add delayed_job_web to dev environment for debugging

* Add specs for the current Follow callbacks implementation

* Move follower touching to ActiveJob

* Spec for the touch followers job

* Move Follow#create_chat_channel to ActiveJob and make the job safe

* Add ActiveJob to send email notifications about follows

* Enqueue SendEmailNotificationJob after the follow is created

* Specs to wnsure jobs are enqueued on Follow creation

* Make CreateChatChannelJob queue name more specific
2019-02-23 18:16:20 -08:00
Ben Halpern
5d1370c3b4
Add padding to video duration (#1812)
* Add proper padding in video_duration_in_minutes

* Add proper padding in video_duration_in_minutes

* Remove ffmpeg from travis for now
2019-02-16 19:31:58 -04:00
Anna Buianova
1cc0fccbf7 Reduce the number of sql queries for articles comments #1606 (#1766)
* Reduce the number of sql queries for articles comments

* Refactor comments tree display

* Refactor retrieving the comments tree

* Remove comments tree view object

* Update score in comments spec for consistent order
2019-02-16 18:14:15 -04:00
Ben Halpern
bce0b4fff6
Remove harsh video restriction and add video duration (#1811)
* Remove harsh video restriction and add video duration

* Fix video meta data and tests

* Modify video tests

* Rescue video duration fetch error

* Change log to puts in test
2019-02-16 17:42:44 -04:00
Anna Buianova
7f6e0cf185 Fix ActiveRecord::RecordNotFound in Delayed::Jobs on article destroy (#1699)
* fixed `ActiveRecord::NotFound` issue for articles, on article destroy
* extracted ActiveJobs from article callbacks
* added specs for article and reaction deletions
2019-02-07 16:57:17 -05:00
Ben Halpern
2d97a5d837
Improve performance for additional content boxes and tags index (#1750)
* Improve performance for additional content boxes and tags index

* Modify followed_articles endpoint with new classic article api
2019-02-06 16:50:35 -04:00
Mac Siri
1137d6fba4 Improve specs (#1693)
* Lock erb_lint

* Refactor moderation spec

* Remove & replace RequestSpecHelper

* Update uid to sequence

* Lower the need for persistence in specs

* Update moderation spec

* Update shoulda-matchers

* Enable backgroundjobs and update commenct spec

* Fix fail specs

* Update comment's validations

* Remove redundent specs

* Actually turn off DJ

* Apply run_background_jobs_immediately

* Remove giveawy specs

* Create Identity spec
2019-02-04 15:56:00 -04:00
Ben Halpern
d7665fcc3f
Add comment template to post (#1692)
* add myself to the core contributors

* add comment template

* merge upstream

* make sure the template re-appears for top level comments after submission

* make interface admin only

* Adjust comment template form

* Fix merge conflicts

* Remove unnecessary comment template from json
2019-01-30 13:32:34 -05:00
Andy Zhao
9f6d00118f Mute notifications for your own article (#1594)
* Use a slightly faster call for user_id

* Remove unused file

* Test receive notifications functionality

* Notify when receive_notifications is true

* Test receiving reaction notifications

* Do not notify if receive_notifications is false

* Fix test for parent comment notification

* Add article mute notifications feature

* Remove deprecated specs

* Prevent email when receive_notification is false

* Update button messaging

* Use RESTful /article_mutes patch request

* Use parent or root article instead
2019-01-22 13:12:48 -05:00
Andy Zhao
68807c6df7 Allow Organizations to Update Slug/Username (#1411)
* Close anchor tag typo

* Remove confusing message in profile

* Fix typo in spec

* Add old_slug and old_old_slug fields to org

* Test for check_for_slug_change method

* Add ability for orgs to change slug

* Update copy to match new org language

* Add redirect for organizations with old slugs

* Use less queries for handling org/user redirect

* Use consistent syntax for user creation

* Test for organization slug redirects

* Refactor user article redirect
2019-01-10 14:16:43 -05:00
Timothy Ng
84bd3a69d7 ApiSecret model for Developer API (#1369)
* Add ApiSecret model scaffold

* Add relationships between ApiSecret, User, Organization

* Add placeholder template to account tab

* Add description column to ApiSecrets

* Add very basic access token generation

* Add basic access token deletion

* Show access token on success flash

* Add placeholder message when user has no secrets

* Use cta style on token generation button

* Add presence validation for ApiSecret description

* Add ApiSecrets factory

* Add pundit policy for ApiSecret

* Nest form field within api_secret hash to allow rails strong params

* Use pundit to authorize ApiSecretController actions

* Add error message flash for ApiSecretsController actions

* Add specs for ApiSecretsController

* Add length validation to api secret description

* Flash model error instead of generic message on save failure

* Truncate ApiSecret factory objects descriptions to prevent validation error

* Remove length restriction on ApiSecret.description

* Use darker font color for token creation date

* Consolidate ApiSecret migrations
2019-01-08 12:30:54 -05:00
rhymes
de5b889445 Fix Rubocop Style/MixinUsage and cleanup prefix_all_images (#1451)
* Use sanitizer to strip HTML tags

* Fix Style/MixinUsage

* Cleanup prefix_all_images

* Stay under 25 lines of code
2019-01-04 14:20:53 -05:00
rhymes
6553f08d94 Rubocop cleanups (#1415)
* Update rubocop-todo.yml with new violations

* Fix Layout/EmptyLine* rules

* Fix Layout/Indentation* rules

* Fix remaining Layout/* rules

* Fix Lint/DuplicateMethods by removing unused accessor

* Fix Lint/IneffectiveAccessModifier

* Fix Lint/MissingCopEnableDirective

* Re-run rubocop auto gen config

* Fix Layout/RescueEnsureAlignment

* Fix Naming/* rules

* Fix some RSpec/* rules

* Fix typos

* Fix RSpec/LetBeforeExamples

* Series should only be an attr_writer, not an attr_accessor

* Fix RSpec/InstanceVariable

* Fix RSpec/InstanceVariable

* Fix RSpec/RepeatedDescription and RSpec/RepeatedExample

* Fix Style/ClassAndModuleChildren

* Fix Style/ConditionalAssignment

* Fix some Style/* rules

* Trigger Travis CI build because failing tests are not failing locally

* Revert "Fix Style/ClassAndModuleChildren"

This reverts commit 1686801d8a1516ba1894f79e24401a20dea65f99.
2019-01-02 11:20:02 -05:00
Andy Zhao
0a8f9ca654 Fix URL Validations and Update Admin Dashboard (#1392)
* Validate for trailing slash instead of strict validation

* Remove unused sign_in_count field

* Add profile URLs to edit view

* Add profile URLs to admin controller params

* Add profile URLs to edit view

* Clean up index and search views for user

* Move around user fields to make more sense

* Display more informative label

* Remove name_of_user field in favor of new display label

* Fix typo

* Remove duplication for website, employer, and Mastodon URLs

* Add score to comment params

* Remove unused name_of_user field views

* Fix typo for medium url
2018-12-26 18:00:02 -05:00
Mac Siri
56ec3e55a2 Refactor Reaction (#1320)
* Refactor Reaction's spec

* Create singleton class in Reaction

* Refactor Reaction
2018-12-13 14:24:33 -05:00
Mac Siri
72eb2fc7b6 Revert "Extract background jobs from Reaction (#1312)" [ci skip]
This reverts commit cd54bece92.
2018-12-12 17:10:42 -05:00
Mac Siri
cd54bece92 Extract background jobs from Reaction (#1312)
* Refactor Reaction

* Update reaction_spec

* Extract update_reactable to job class

* Create ApplicationJob

* Rename Engagement::UpdateReactableJob to ReactionCascadeJob

* Rename ReactionCascadeJob to Reaction::UpdateRecordsJob

* Refactor Reaction::UpdateRecordsJob

* Remove unused method

* Change module to class
2018-12-12 16:41:31 -05:00
rhymes
96d01b20a2 Use allow/allowed instead of whitelist (#1296)
* Use allow/allowed instead of whitelist

* Remove duplication in comment
2018-12-10 13:16:16 -05:00
Jibran Kalia
f569f33e4f [WIP] Really simple calculate reading time function (#1283)
* Really simple calculate reading time function

* Move parse_it so that the number of methods in MarkdownParser is at 20

* Added test and default value for reading time
2018-12-09 13:42:32 -05:00
Ben Halpern
6b96201265
[WIP] Allow mods to remove tags and send user notification (#1252)
* Initial tag adjustments

* Finalize tag adjustments and tag adjustments controller

* Fix schema.rb

* Finalize tag removal logic

* Adjust edge cases/tests for tag adjustment moderation

* Adjust tag adjustments spec
2018-12-04 16:45:32 -05:00
Michael Kohl
ffd24f791e Add Mastodon URL to profile (#1137) 2018-12-04 13:24:53 -05:00
Ben Halpern
651ab3ce35
Add point weights for tag follows (#1229)
* Add point weights for tag follows

* Adjust num articles to initially show up on home page

* Fix schema.rb

* Adjust follow policy spec

* Adjust dashboard styling for follow points form
2018-11-30 15:36:58 -05:00
Ben Halpern
011e267769
Update mentor matching page (#1218)
* Update mentor matching page

* Update mentorship relationship spec
2018-11-28 19:02:47 -05:00