Commit graph

153 commits

Author SHA1 Message Date
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
cyrillefr
8c52d5c43f Move remove_each notifications method in own job (#2946) 2019-05-29 16:26:18 -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
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
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
Ben Halpern
6c2498b1b8
Render correct editor based on article's existing format (#2856)
* Render correct editor based on article's existing format

* Add check for user in /new
2019-05-16 15:25:43 -04:00
cyrillefr
68f06c2076 send_milestone_notification in own job (#2804)
- that calls a service
  - spec for job + move spec to service
  - minor refactoring
2019-05-16 13:46:50 -04:00
Anna Buianova
dd0fbf002b ActiveJob for updating notifications #1996 (#2839)
* Notifications::Update service

* Update notifications ActiveJob

* Raise an exception when wrong notifiable class passed to a job
2019-05-15 12:37:25 -04:00
Kobe Raypole
509c7a3388 Move async article methods to ActiveJob (#2647) 2019-05-10 12:52:00 -04:00
cyrillefr
ecdbee64ab Move tag adjustment notification to Active Jobs (#2654) 2019-05-10 11:06:29 -04:00
rhymes
e626002260 Add alternative texts to images (#2771) [ci skip] 2019-05-09 11:16:03 -04:00
rhymes
4e591fea1c Show localized date/time on hover for articles/comments (#2722)
* Add article decorator published_timestamp

* Use time HTML5 element and refactor date in partial

* Add published_timestamp to Article

Adding `published_timestamp` to the homepage we can then use JS to render the full timestamp localized for the user.

We've also added the timestamp to the index and the API

* Display article published timestamp on hover

* Use time also in the article show page

* Add timestamp to bottom articles as well

* Remove published_timestamp from index because it is not used

* Fix broken specs

* Add more article dates specs

* Refactor date initializers
2019-05-09 11:05:17 -04:00
Ben Halpern
41d3f7ef39
Add credits counter_culter to users and orgs (#2689) 2019-05-04 10:50:48 -04:00
Ben Halpern
15ea00328c
Award credits along with badge achievements (#2683) 2019-05-03 15:38:25 -04:00
Ben Halpern
5891b2ea58
Add application "page" model (#2657)
* Generate page model

* Add page model

* Conditionally modify html rendering
2019-05-02 18:24:06 -04:00
Ben Halpern
f12f00decd
Add profile_image_90 to serialized data on article (#2661) 2019-05-02 15:47:22 -04:00
Ben Halpern
821d45104a
Create serialized cached user and cached organization for articles (#2658)
* Create cached user and cached organization for articles

* Remove pages table
2019-05-02 14:42:28 -04:00
Anna Buianova
065ef29e31 Added unique index to notifications #2124 (#2213)
* Added unique index to notifications #2124

* Fix migration + add index to schema.rb

* Shoulda matcher notification unique validation
2019-05-01 13:15:06 -04:00
Ben Halpern
158f56bc9d
Add page for users to "manage" their posts after publication (distribution, etc.) (#2627)
* Set up basic /manage route

* Add basic article manage page

* Add tips and finalize permissions for /manage

* Add final test and add manage button to article show

* Update failing specs
2019-05-01 09:00:09 -04:00
Anna Buianova
dd11478659 Change format of the user languages_settings #2369 (#2496)
* Change format of user preferred languages

* Make sure user language settings are set by default

* Add missing expect to the user spec

* Fix users/misc template

* Move existing languages to a constant

* Remove commented user code

* Move languages out of User model

* Update preferred languages accordingly to the available languages

* Set user estimated language only if the language is available

* Fix Portuguese spelling #2582
2019-04-30 17:01:19 -04:00
Anna Buianova
d2d405ad37 Add validation to classified_listings user and organization (#2625) 2019-04-30 09:35:08 -04:00
rhymes
af83bab2d0 Escape range separator (#2593)
The char "-" in regexp defaults a a separator for a range of character, for example: "a-z", Ruby is smart enough to understand "-_" is no range but it does emit a warning, by properly escaping the char "-" we ensure that no warning or issues can arise in the future.
2019-04-29 14:27:26 -04:00
rhymes
743316b528 Move send new badge achievement notification to ActiveJob (#2474) 2019-04-29 10:51:08 -04:00
Ben Halpern
076047e13b
Add proper filtering for inappropriate tags in listings (#2611) 2019-04-29 09:21:42 -04:00
Bolarinwa Balogun
1578befdf1 Add Twitch to Profile Links (#2557) 2019-04-25 16:14:28 -04:00
Anna Buianova
46b1b1d28a Fix lints (#2553) [ci skip] 2019-04-25 07:56:15 -04:00
Ben Halpern
78138532c8
Classified Listings (#2545)
* Initial classified listings work

* More work on tags

* Additional work finalizing stripe and getting the listings page along

* Finalize-ish listings 🤞
2019-04-24 16:17:01 -04:00
rhymes
9d2c89fd2f Upgrade factory_bot_rails to 5.2.0 (#2532) [ci skip] 2019-04-23 13:21:22 -04:00
Andy Zhao
182a787ac4 Add OrganizationMembership model (#2471)
* Remove deprecated analytics role

* Make anchor tag a bit more readable

* Add OrganizationMembership table and model

* Add organization_membership associations

* Add unique indices for user_id and org_id

* Wrap update and create calls in transactions

* Remove specs of deprecated analytics_beta_tester
2019-04-22 14:08:02 -04:00
Andy Zhao
4e8787f606 Convert underscores in article slugs properly (#2472) 2019-04-17 12:35:37 -04:00
rhymes
7d3fb0c0b5 Enable random order for specs (#2466) [ci skip] 2019-04-17 11:30:23 -04:00
Ben Halpern
4b1b137c0f
Fix/augment dashboard and article view count issues (#2449) 2019-04-15 10:24:38 -04:00
Anna Buianova
d27874adc9 Move estimating user default language to ActiveJob (#2373)
* Move estimating user language logic to a service object

* Call a service from a User#estimate_default_language!

* ActiveJob for estimating default user language

* Call ActiveJob from the User#estimate_default_language

* Handle nil user email when estimating default language

* Switch user.estimate_default_language_without_delay! to estimate_default_language! in specs
2019-04-13 15:54:22 -04:00
Ali Spittel
409c280c10 pinkify DEV (#2425) 2019-04-13 11:25:02 -04:00
rhymes
d0441bb456 Enable Rails/TimeZone cop (#2334) [ci skip] 2019-04-09 15:38:28 -04:00
Anna Buianova
f1d371c670 Set users email to nil instead of blank (#2305)
* Set users email to nil instead of blank

* Remove uniqueness validation duplication for users

* Fix organization following test in case the name contains quotes
2019-04-08 19:12:56 -04:00
Ben Halpern
bd95c6a8bf
Fix human language detection (#2338)
* Update language detection

* Modify feed to account for languages
2019-04-08 15:47:29 -04:00
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