Commit graph

41 commits

Author SHA1 Message Date
Daniel Uber
d0c6088253
quote localized strings in credits/purchase embedded script (#15623)
* Add view test for change submit button

Expect a quoted string for the button values.

* Quote button text in calls to changeSubmitButton

This fixes a parse error (locally now I get an error about not having
a stripe publishing id, which is expected).
2021-12-01 10:07:55 -06:00
Daniel Uber
8f7e0b1744
Let users purchase credits (#15346)
* Dark Theme preference is a user setting and not delegated

Resolves NoMethodError

* Add a view spec

This ensures the /credits/purchase page is rendered

* Test both styles based on user setting

Add an actual expectation to the view test
2021-11-10 15:18:52 -06:00
Daniel Uber
e3ebc623da
Compare the utc offset from the timestamp, not now (#15256)
Time Zones are political things, and move. The timezone database knows
this, and correctly interprets times as they would have been at the
time.

For example, when the Time zone is Africa/Monrovia, the offset now is
0, but the offset in 1970 was -44.5 minutes, so Time.zone.at(0) is Dec
31st, 1969, 23:15:30 and not Jan 1st, 1970 00:00:00.

Prevent this spec from randomly failing based on Zonebie's selected
timezone by comparing the offset _then_ against UTC, and predicting
whether the 60's have ended yet.
2021-11-01 15:49:35 -05:00
Daniel Uber
43adc9f1fb
cross posted articles showing <time> tag (#15224)
* Maybe this is what we need to do?

* Undo change to keyword

Use the on_html translation in the view, but pass 'on' as a keyword to
the template.

* remove unused translation

Since we only want to use views.articles.crossposted.on.html (and this is only used in the
article show template) - remove the unused 'on' key from the
translations file.

* Add a spec

Tested that this fails in main and passes on the branch

* Check that the original publication date is shown in the users local

And that it's not a <time> tag presented as text

* Correct local date selection error

If time zone was UTC (i.e. offset from utc was 0) the check for
positive? was false, I meant "non-negative" (positive or zero). Invert
the test.
2021-10-29 12:10:53 -05:00
Jamie Gaskins
70cf28ca7b
Fix rotation of images uploaded from iPhones (#15010)
* Fix rotation of images uploaded from iPhones

iPhones[1] take pictures in portrait mode with the orientation set to
90ºCCW. We noticed that uploading one of these images to a Forem
instance caused the image to be rotated when rendered. The current
theory is that Imgproxy is not maintaining the orientation value when
processing, which is solved by setting `auto_rotate: true` (serialized
into the Imgproxy URL as `ar:1`), according to the documentation.

See: 8e6585e28d/docs/generating_the_url_advanced.md (auto-rotate)

[1] This probably happens with other phones, but we discovered the issue
using an iPhone.

* Fix Imgproxy URL expectation for auto_rotate
2021-10-11 15:17:14 -04:00
Molly Struve
e87dead7ad
Use new UserSetting and UserNotificationSettings and Ignore Related User Table Fields (#14121)
* schema file undelete description

* feat: v1 of the script

* Flesh out remaining enums under their categories

* complete UsersSettings data update script

* complete DUS for relevant attributes in users and profiles tables

* complete DUS for users_notification_settings

* alphabetize user_settings sql file

* safeguard against null values for "null: false" settings

* Set up actual UsersSettings DUS and specs files

* fix broken DUS script

* complete specs for UsersSetting DUS

* Address QA of specs

* complete specs for users_notification_settings DUS

* fix the typos (thanks Julianna!)

* begin implementation

* still building

* add missing attribute "email_membership_newsletter"

* complete sync code (except race condition for user profile)

* complete implementation, remains tests

* Address PR review and fix Travis fails

* remove superfluous Profile.new

* fix travis fails

* feat: update the users_notification_setting attributes from the user model

* feat: use the config fonts enums to display the fonts

* feat: loop through the keys

* fix profile = nil blowing up; add specs for notification_setting model

* remove unneeded spec

* remove feed validation until after sync code removed; fixes feed_import spec failures

* remove spec associated with feed_url validation in user_setting model

* fix failing spec 😅

* add TODO

* feat: set the user settings in the user controller  and use it in the customization form

* feat: move some update logic to the users settings controller thats being used from customization

* feat: show the updated values form the users_settingd and not the user instance

* Generalize redirect back to current tab

* still trying to reflect changed theme upon refresh

* customizations take effect on refresh

* remove 'with_feed' scope from user model

Co-authored-by: Jamie Gaskins <jamie@forem.com>

* start with takeover for fields previously in profiles table

* Takeover code for `publishing_from_rss` section in Settings (#13914)

* implement takeover code part 1

* implement takeover code

* fix feed fetch

* need rhymes help

* complete implementation; specs pending

* fix STUPID omission that caused so many headaches 😫

* implement profile fields pointing to users_settings 🎉

* run migrations

* implement inbox type & guidelines takeover code; specs pending (#13911)

* Point changes in notification settings to `users_notification_settings` table (#13910)

* implement takeover code; remains specs

* address PR feedback; remove related sync code

* address PR review feedback

* need help with routing and specs

* address pr review

* addressing pr review

* Treat implementation edge cases and omissions 😅

* fix uncommented comment

* fixing implementation cases

* address more PR review feedback

* fixing notifications use-cases

* refactor settings controller

* more pr review changes

* solving bugs

* fix broken onboarding

* handle eperience_level calls

* more fixes

* remove unneeded mappings

* add To-dos for quety updates

* remove done TODO

* purge done TODOs

* update notification_settings-related queries

* start fixing specs

* fixing specs

* fix notification and lrg_forem specs

* fixing broken specs

* still fixing

* fix line dif and remove reloads from user.rb

* run specs

* silence bullet and other fixes

* remove setting migration scripts and specs, fix more settings for specs

* handle missing user for article builder and fix notification specs

* fix some final controller specs and re-add incorrectly removed specs

* remove deprecated data update scripts and related workers, put travis back

* refactor admin tags mods controller, write/move specs for users notifications settings controller

* schema cleanup and other small refactors for consistency

* set field we can invalidate in spec via active record instead of at the db level

* remove I think an uneccessary hook call from subscribe_to_mailchimp_newsletter

* use bnefore_create to setup settings, please dont blow up the test suite

* mailchimp bot fix

* remove decorator in favor of single model method

Co-authored-by: Arit Amana <msarit@gmail.com>
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>
Co-authored-by: Jamie Gaskins <jamie@forem.com>
2021-07-08 09:31:34 -05:00
Michael Kohl
6dfabd578f
Rename SiteConfig to Settings::General (#13573)
* Rename SiteConfig

* More renaming

* Update spec

* Update mandatory settings mapping

* More renaming

* e2e test fixes

* You have a rename, and you have a rename

* Spec fix

* More changes

* Temporarily disable specs

* After-merge update

* Undo rename for migration

* undo rename of DUS

* Fix DUS

* Fix merge problem

* Remove redundant DUS

* Fix specs

* Remove unused code

* Change wrong class name

* More cleanup

* Re-add missing values to constant

* Fix constant

* Fix spec

* Remove obsolete fields

* Add accidentally removed field

* Update spec

* Move methods from Settings::General to ForemInstance

* Remove unneeded model

* Change mentions of 'site config'
2021-05-21 14:45:37 +02:00
Michael Kohl
b7ff9aadd1
Clean up SiteConfig (#13738)
* Remove obsolete SiteConfig values

* Remove DUS

* fixup! Remove obsolete SiteConfig values

* fixup! Remove obsolete SiteConfig values

* Add DUS for removing SiteConfig values

* Fix specs

* Fix specs

* Clean up more DUS

* Update DUS

* Fix remaining spec

* Remove leftover spec

* Fix more specs

* Fix spec

* Remove deprecated spec

* Rearrange specs

* Temporarily disable specs
2021-05-18 09:38:31 +07:00
Michael Kohl
111b7316d9
Remove mascot footer image (#13642)
* Remove footer mascot image

* Move remaining mascot settings back to SiteConfig

* Add data update script

* Update usages

* Fix path

* Remove dead route

* Update tests

* Fix view and spec

* Fix e2e test

* Fix DUS
2021-05-11 13:55:18 +02:00
Michael Kohl
610f6151e6
Split Settings::Community from SiteConfig (#13403)
* Add settings_community_contents model

* Add settings_communities model

* Update usage

* Add controller and update code

* Add e2e test

* Add data update script

* Update schema.rb

* Fix specs

* PR feedback

* Remove experience_* from Settings::Community

* Update spec

* Fix spec
2021-04-26 10:46:35 +02:00
Michael Kohl
f2f5e911cf
Add Settings::Mascot (#13451)
* Add Settings::Mascot

* Add DUS

* Update usage

* Fix e2e test and controller

* Fix specs

* Fix remaining spec
2021-04-26 11:39:19 +07:00
Vaidehi Joshi
3f6600541e
✂️ Remove the approvals gem ✂️ (#12978)
* Remove approvals fixtures

* Remove approvals initializer

* Remove approvals gem

* Remove approvals step from travis.yml

* Remove approvals from dockerignore and gitignore

* Remove references to approvals gem in docs

* Un-approvals spec/liquid_tags/codepen_tag_spec.rb

* Un-approvals spec/liquid_tags/dotnet_fiddle_tag_spec.rb

* Temporarily skip other approvals tests

We will still need to delete files in /spec/fixtures/approvals after this.

* Revert changes to dotnet_fiddle_tag_spec and codepen_tag_spec, skip those tests instead

* Temporarily skip more approvals based tests

* Attempt at moving html doc inline

* Comment out one more approvals spec

* Update dotnet fiddle and codepen liquid tag specs to not use Approvals

* Update liquid tag specs + system specs to not use Approvals

* Un-approval feed import, github issue, and tweet tag specs

* Re-add .approvals to gitignore and dockerignore

* Use Rspec compound expectations
2021-03-19 13:28:06 -07:00
Arit Amana
04d5ea8e82
Update the UI for Low-Quality-Comments Notice (#12952)
* Implement change for regular comments

* Modify tests and implement for deleted-commentable-comment

* Fix stupid mistake
2021-03-16 09:40:29 -04:00
Ben Halpern
1a25fb3542
Add max_bytes to imgproxy. (#12110)
* Add format to image optimizer

* Only use max bytes

* Fix show view spec
2021-01-04 14:41:32 -05:00
ludwiczakpawel
70706d0a62
Comments UI update (#11283)
* tooltips 1.0.1

* tooltips 1.0.1

* init

* .

* drop not needed files

* .

* init

* init

* .

* comments

* border

* missing bits

* build comment JS

* .

* .

* specs

* sloan avatar fix

* bunch of fixes

* specs and fixes

* specs

* .

* swap order of links

* contrast

* js for dropdown

* icons

* op-author

* three dots icon

* reverts

* test: capybara- make sure that we click the dropdown before clicking on edit

* permalink --> link

* tiny fixes

* aria-label on form

* proper alt on user's avatar

* aria has popup

* use UL > LI instead of DIV

* add aria-labels to dropdown items

* another aria-label

* better links: nav

* contrast

Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
2020-11-18 18:21:19 -05:00
n martin
bae898ed1a
Show canonical URL on article even after it has been updated (#11256)
* Show canonical URL on article even after it has been updated

* Refactor canonical URL fix

* Clean up canonical URL code

* Clean up canonical URL code
2020-11-10 13:30:21 +01:00
Mac Siri
540bc1fd84
[deploy] Add Imgproxy docs (#11104)
Co-authored-by: Molly Struve <mollylbs@gmail.com>
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2020-10-29 09:03:55 -04:00
Jacob Herrington
d479834344
Do not set SiteConfig values in specs (#11125) 2020-10-27 15:56:31 -04:00
Michael Kohl
1a44d717fc
[deploy] Move settings tabs to constant (#10859) 2020-10-16 08:30:58 +07:00
Vaidehi Joshi
3d169b5e6f
Do not require SiteConfig.tagline (#10623) [deploy]
* Fix incorrect formatting in admin/configs/show.html.erb

* Only render SiteConfig.tagline if it exists

* Fix typo in _signup_modal.html.erb

* Remove tagline from VerifySetupCompleted::MANDATORY_CONFIGS

* Improve signup_modal tagline specs

* Tiny fixes to address @citizen428's comments
2020-10-06 10:34:34 -07:00
ludwiczakpawel
1375e8a4df
[deploy] Redesigned Comment Form (#10355)
* init

* .

* .

* better

* last bits

* specs

* merge

* fix response templates for replies

* copy

* active inactive buttons + cleanup

* labels

* specs

* specs

* response templates fix

* ....

* wtf

* .
2020-10-05 12:01:48 +02:00
Mac Siri
8d9db4cce1
Update Imgproxy to use predetermined endpoint (#10412) 2020-09-28 18:30:29 -04:00
Mac Siri
b5be5990e4
[deploy] Expand Images::Optimizer to support imgproxy (#9909)
* Create _comment.html.erb spec

* Add imgproxy.rb

* Setup imgproxy MVP

* Expand Images::Optimizer to support imgproxy

* Enable imgproxy in dashboards/show WIP

* Create view spec

* Fix typo

* Also check for Imgproxy.config.endpoint

* Use ApplicationConfig instead of ENV

* Update Images::Optimizer#call
2020-08-25 16:00:40 -04:00
Ben Halpern
6c71369df5
[deploy] Add community_name to site config (#9864)
* Add community_name to site config

* Fix a spec

* Remove SiteConfig from constants

* Change subjects to method

* Fix subjects method

* Fix linting
2020-08-19 14:54:40 -04:00
Andy Zhao
a589529269
[deploy] Allow org admins to delete their organizations (#9357)
* Add destroy organization backend

* Add view for deleting org

* Add new line to end of file

* Refactor and move destroyable? to model

* Use a nice card to distinguish the message

* Prevent organizations from being deleted if they have credits

* Fix codeclimate issues

* Remove let_it_be_changeable for flakiness
2020-07-28 12:00:15 -04:00
Michael Kohl
fb27f52ed0
[deploy] Display banner if site hasn't been configured (PRE DEPLOYMENT TASKS) (#8435) 2020-07-07 07:37:04 -05:00
Michael Kohl
158b3f1307
Display 'Originally published' for canonical URLs (#8761) 2020-06-18 08:10:47 -04:00
ludwiczakpawel
16f4d7d46a
[deploy] Article Design update (#8234)
* flare tag line height

* .

* init

* widgets

* widgets lists

* new tabs on home

* instantclick

* .

* rethinking css

* .

* .

* empty space

* init

* campaign widget

* .

* merge

* .

* update layout

* fix sidebars on home page

* .

* fix onboarding x

* test

* spec

* test

* toolbar fix

* more

* test

* better handling ads

* .

* spec

* card border

* .

* .

* actions bar

* cleanup

* animation

* test

* button width

* .

* better responsiveness and author boxes

* meta info

* padding

* better animation

* optimize videos

* fixes

* spec

* .

* codeblocks in comments

* whoops

* Use .present? correctly as it preloads items

* sticky nav

* Update app/views/articles/_sticky_nav.html.erb

I don't know what I'm doing but @benhalpern says so! e8c0f337a5 (r440248874)

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>

* Update app/views/articles/show.html.erb

I don't know what I'm doing but @benhalpern says so! e8c0f337a5 (r440247802)

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>

* little fixes

* Update app/assets/stylesheets/article-show.scss

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>

* pawel updating ruby code......

* actually better merge

* semantic updates

* .

Co-authored-by: rhymes <rhymesete@gmail.com>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-06-17 09:57:57 -04:00
rhymes
883eb170de
[deploy] Authentication refactoring: add available and enabled providers (#7505)
* Add Providers(.available|.enabled|.enabled?)

* Add provider_sidebar partial

* Add providers_signup_modal partial and Providers.sign_in_url

* Use path helpers

* Add providers_nav_menu partial

* Add providers_registration_form partial

* Generalize users/additional_authentication

* Refactor sign_in_path and authentication_path

* Add .official_name and fix specs

* Preload authentication providers correctly and use less Ruby magic

* Put require_dependency in the correct place
2020-04-28 16:16:28 +02:00
ludwiczakpawel
16560d9ef1
Settings style updates: Crayons! (#7393)
* .

* .

* .

* snapshot

* whoops

* halifax

* tests

* little fixes

* little fixes

* test? i guess..

* .

* minor fixes

* Update schema.rb

* Use shared logo_design in new org partial

* little fix

* Fix org spec

* decrayonsifying rich-selector

* if statement

Co-authored-by: rhymes <rhymesete@gmail.com>
2020-04-22 19:18:19 +02:00
Ridhwana
a2f1a0049f
Removal of morrrre hardcoded dev.to links (#7390)
* feat: remove 90% of hardcoded dev.to links now

* chore: update tests

* chore: implement suggested changes

* chore: update url

* chore: update to use URL helper
2020-04-21 11:50:18 +02:00
Jibran Kalia
17037761a8
Add community_member_description, tagline and mascot_image_url to SiteConfig. Enable Cloudinary for primary_sticker_image (#7056) [deploy]
* Add community_member_description, tagline and mascot_image_url to SiteConfig

* extra space

* Add mascot_image_description field to SiteConfig

* Fix test
2020-04-06 18:09:45 +02:00
Mac Siri
0195d1be5b
Create specs for users/edit.html.erb (#6739)
* No longer create identity in User factory

* Create view specs for users/edit.html.erb

* Update broken specs

* Make identities transient an explicit array
2020-03-20 11:29:20 -04:00
Mac Siri
5fba3bd4b9
Improve test speed (#3957) [ci skip] 2019-09-12 16:17:20 -04:00
Mac Siri
fc39f24ee3 Migrate feature test to system test (#2301)
* Move all features to system

* Remove database_cleaner & apply use_transactional_fixtures

* Move rspec-retry to :test

* Update Capybara config

* Update rails_helper

* Fix user_visits_a_comments_page_spec.rb

* Fix lint
2019-04-04 12:15:10 -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
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
Kohei Sugi
36d2dfd122 Apply rubocop some rule (#295)
* Fix FactoryBot/StaticAttributeDefinedDynamically and Metrics/LineLength

* Fix RSpec/NotToNot: Prefer not_to over to_not

* Fix RSpec/NotToNot: Prefer not_to over to_not and Metrics/LineLength

* Fix Layout/MultilineMethodCallIndentation and Metrics/LineLength

* Fix Naming/PredicateName

* Fix Style/ConditionalAssignment

* Avoid code climate error
2018-08-13 16:32:11 -04:00
rhymes
e588fa7ece Code cleanups (#659)
* Initial automatic cleanup with rubocop

* Fix syntax error introduced by rubocop

* Cleanup seeds file

* Cleanup lib folder

* Exclude bin folder because it contains auto generated files

* Make Rubocop a little bit more chatty

* Block length should not include comments in the count

* Cleanup config folder

* Cleanup specs

* Updated Rubocop version and generated a todo file

* Fix broken ArticlesApi spec

* Fix tests

* Restored rubocop pre-commit hook
2018-08-07 11:00:13 -04:00
Mac Siri
84122959bf Update unsubscribed page's copy and css (#199)
* Update unsubscribed page's copy and css

* Create view spec for email_subscriptions/unsubscribe

* Update unsubscribed's page copy

* Prevent search-engine crawlers
2018-04-10 15:02:20 -07:00
Mac Siri
301c6080e3 Initial commit 2018-02-28 16:11:08 -05:00