Commit graph

5852 commits

Author SHA1 Message Date
Jeremy Friesen
7989226d3f
Jeremyf/refactor order of operations (#15192)
* Adding guard clause for nill org feed score

There's no sense running a query if we don't have an organization.  This
is a small refactor that might offer a most nominal speed bump

* Caching calculated value

Prior to this commit, we calculated the user_experience_level once per
article in the feed.

This change adds a cache, creating a minor computational improvement.
2021-10-26 10:18:52 -04:00
Jeremy Friesen
fbce226c08
Low Stakes Refactor of Feed class (#15180)
* Removing state change and unused method

Prior to this commit, the `@comment_weight` value would change.  This is
not ideal as depending on the call sequence, can notably change the
output.  I suspect this state change occurred so as to not alter an
underlying spec.

What this change does is remove the state change, removes a dead method,
renames a method (to the dead method name), and leverages
parameterization to better test a spec that was brittle based on
possible state changes.

I believe, from a logical stand point, that this change does not impact
the functionality nor the actual logic that is part of the production
call path.

* Marking methods as @api private

The goal is to highlight that we really shouldn't be calling these
outside of their contained class.  Ideally, I'd love to make them
private methods, but there are specs and would prefer to not use
`__send__` to change those specs.

This is a noop change.

* Renaming method to refelct returned param order

Prior to this commit the "default_home_feed_and_featured_story" returned
an array of `[featured_story, default_home_feed]`.  The method name and
the order of the returned values were misaligned.  This change helps
align the method name and the order of those returned values.

Note, methods such as `each_with_index` have an `element, index`
parameter order.
2021-10-26 09:57:33 -04:00
ludwiczakpawel
88a3b573ea
Page headers unified (#15158)
* fix; remove the bottom 100%

* dashboard

* fixes + magic border-radius

* everything

* fix

* fix

* spec

* split PRs

* Update app/assets/stylesheets/views/listings.scss

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
2021-10-25 21:41:29 +02:00
Andy Zhao
864fd9e072
Use proper Node version for Storybook (#15182)
* Try using Netlify pre-built yarn

* Add env vars to maybe trigger Yarn

* shrug

* Try using npm to build storybook

* Add  npm install

* Update node version and use original command

* Update yarn version

* idk :(

* Try pulling versions from files instead of hardcoding

* Possibly in root already?

* never mind dynamic var usage is not supported

* yarn version prob unused b/c we technically use npm
2021-10-25 15:29:03 -04:00
yheuhtozr
ffd8c9ed1b
actions and reactions i18n (#15058)
* actions and reactions i18n

* remove ja.yml

* Update en.yml

* Update fr.yml

* Update _actions.html.erb
2021-10-25 12:35:05 -06:00
Ikko Ashimine
dbf3cf75fa
Fix typo in create_from_controller_params.rb (#15171)
interation -> interaction
2021-10-25 10:42:40 -07:00
yheuhtozr
6a3a91d9b7
views/podcasts, views/podcast_episodes i18n (#15020)
* views/podcasts, views/podcast_episodes i18n

* reformat for PR

* helper labels

* PR sync with main

* remove ja.yml

* Update en.yml

* Update fr.yml

* Update _meta.html.erb

* Update podcast_episodes_index_spec.rb

* Update podcast_create_spec.rb

* Update user_visits_podcast_episode_spec.rb

* Update en.yml

* Update feed.rb

* Update index.html.erb
2021-10-25 14:32:51 +01:00
ludwiczakpawel
719b87e2ae
Auto border-radius (#15165) 2021-10-25 14:41:13 +02:00
ludwiczakpawel
656cfcd655
Tag edit (#15173)
* tag edit

* more

* chop chop

* spec

* Apply suggestions from code review

Co-authored-by: Michael Kohl <me@citizen428.net>

* french translation

* Fix I18n usage

* Apply suggestions from code review

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* lang

Co-authored-by: Michael Kohl <me@citizen428.net>
Co-authored-by: Michael Kohl <citizen428@forem.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-10-25 12:50:00 +02:00
yheuhtozr
cdedbc1588
views/notifications i18n (#15056)
* views/notifications etc i18n

* notifications PR fixes

* remove ja.yml

* Update en.yml

* Update fr.yml

* Update en.yml

* Update fr.yml

* Update _comment.html.erb

* Update _comment.html.erb

* Update notifications_helper.rb

* Update notifications_helper.rb

* Update notifications_helper.rb

* Update notifications_helper.rb

Co-authored-by: Michael Kohl <citizen428@forem.com>
2021-10-25 15:46:46 +07:00
Lewis Sparlin
e621659279
Add Article post_commit when user_id changes with specs (#15132)
* Add Article post_commit when user_id changes with specs

* Add example in requests/admin/articles_spec for updating user
2021-10-25 10:53:21 +07:00
ludwiczakpawel
1c03584acf
missing padding (#15168) 2021-10-22 22:35:05 +02:00
Jamie Gaskins
10e3fc2af6
Remove whitespace in element attributes (#15166)
For most of these this isn't a big deal because `class` is delimited
by whitespace, but it changes the meaning of the `id` attribute since it
must be an exact match (including whitespace). There is also a data-*
attribute or two in here that may have had their semantics changed.
2021-10-22 15:08:17 -04:00
Jamie Gaskins
405f6a1f91
Fix "Unpublish Article" button (#15162)
The malformed link ended up messing up HTML further down the page,
hiding the "Unpublish Article" button because the browser didn't parse
it as a separate element.
2021-10-22 12:09:06 -05:00
Nick Taylor
2b135ab8e3
Small change to make the tools section of member details mobile friendly. (#15159) 2021-10-22 18:47:20 +02:00
Jeremy Friesen
24929ba20d
Naming "magic numbers" to help clarify (#15161)
As part of my reading and seeking to understand the
`Articles::Feed::LargeForemExperimental` class, I figured I would come
in and add parameters.  In adding parameters, one thought I had was that
we can more readily create a data structure that allows us to tweak the
various implicit values.

This is a first step to help me understand and name the numbers.
2021-10-22 12:37:11 -04:00
Ridhwana
cb6babc595
Fix Tooltips (#15156)
* fix; remove the bottom 100%

* refactor: make the tooltip appear at the top + no pointer-events
2021-10-22 07:49:15 -07:00
ludwiczakpawel
d1aac57053
Podcasts fixes (#15130) 2021-10-22 11:06:11 +02:00
Nick Taylor
bf2d673492
Created the Forem creator confirmation email template (#14659)
Co-authored-by: Michael Kohl <citizen428@forem.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2021-10-21 14:56:09 -04:00
Daniel Uber
c10d582e2a
Ensure shown vomit reactions have reactable (#15153)
This is the counter-argument to #15152 - filter in the controller
rather than adding lots of conditional logic to the view to handle the
case where there was a vomit reaction left for a deleted user causing
the moderation reports page to fail to load.
2021-10-21 11:34:06 -05:00
rhymes
0dd11b3da5
Replace spread syntax with Object.assign in untranspiled JS file (#15148) 2021-10-21 14:01:05 +02:00
Ridhwana
085a506205
Navigation Links Validation (#15139)
* feat: add a required attribute for the fields on Navigation Links that are required

* remove the weird margin

* we want the field to be required only when we  don't have a vallue from form.object[:icon] that is in the craete view
2021-10-21 12:43:05 +02:00
yheuhtozr
e826fabf18
views/liquids i18n (#15060)
* views/liquids i18n

* PR key name changes

* remove ja.yml
2021-10-21 12:25:30 +07:00
yheuhtozr
7eea2b6a22
article editor and manager i18n (#15070)
* article editor, manager i18n

* PR key name changes

* remove ja.yml
2021-10-21 08:18:48 +07:00
Arit Amana
55a6bc3644
Allow users to choose their default Home and Tags-View Feed (Part 1) (#15128)
* add new column & define enums

* add new column & define enums

* add tests; improve enum naming

* complete specs update 😅

* discard changes to schema.rb

* rename column name more appropriately

* update specs

* update specs properly 🤦🏾‍♀️

* Please Travis do the thing

* Add DB schema diff

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>
2021-10-20 18:02:59 -04:00
yheuhtozr
cdb823bdf9
views/moderations i18n (#15068)
* views/moderations i18n

* PR key name changes

* remove ja.yml
2021-10-20 10:48:14 -05:00
yheuhtozr
8b87086200
views/badges etc i18n (#15021)
* views/badges etc i18n

* reformat for PR

* remove ja.yml

* PR argument error fix?
2021-10-20 09:36:30 -06:00
yheuhtozr
7504a243fd
views/tags etc i18n (#15039)
* views/tags etc i18n

* remove ja.yml

* YAML reformatting
2021-10-20 08:13:51 -06:00
Ridhwana
656e1a6f79
Remove focus from username field when enter is pressed on any of the input fields (#15125)
* feat: add type button

* feat: open up the username field is we press keydown on the edit username element

* fix: remove the keypress

* fix: add type: button to the password field

* trigger github hooks
2021-10-19 18:26:20 +02:00
Michael Kohl
26aef9da93
Don't notify authors about own org posts (#15113) 2021-10-19 21:32:44 +07:00
Suzanne Aitchison
5069cd681a
Markdown editor toolbar (#14876)
* rough starting point, roving tabindex in toolbar, bold and italic buttons

* refactor, add link

* add ul

* add ordered list

* core formatters in place, wip

* overflow options

* add keyboard shortcuts

* tidy up some dodgy classes

* add mocks for runtime in test and storybook, use correct modifier key for tooltip

* style tweaks

* refactor tooltips

* add markdown formatters tests

* add tests for toolbar component, fix mistake in overflow menu tooltips

* undo change no longer needed to button

* fix issue accessing runtime in formatters file

* only show darkened buttons and tooltips when focus-visible is true

* mobile view

* fix for responsive buttons & roving tabindex

* tweaks from PR review

* update cursor position on link insertion

* add a new line after block selection formatting

* align icons in center

* tidy up overflow menu listeners

* small refactors

* test for new text area util

* tidy up new lines after syntaxes

* fix logic in cursor offsets for links

* prevent scroll jumps after inserting syntax

* some style tweaks

* insert level 2 heading with new lines above and below

* update icons

* use margin instead of gap
2021-10-19 09:22:54 +01:00
Takuma
e8d04165b4
Fix hamburger menu scrolling (#15000) 2021-10-18 20:51:46 -04:00
yheuhtozr
3e009e3e8b
views/reading_list_items i18n (#15041)
* views/reading_list_items i18n

* remove ja.yml

* reading list items PR typo fix
2021-10-18 11:32:57 -07:00
yheuhtozr
d80f451c95
views/collections i18n (#15019)
* views/collections i18n

* reformat for PR

* remove ja.yml
2021-10-18 14:10:32 +07:00
Ben Halpern
09fa66a03f
Fix and clean up podcast pages (#15004)
* Fix and clean up podcast pages

* Adjust tests

* Fix a test

* Fix missing i18n

* Fix tests

* Fix tests

* Fiddle with test

* Sure up css and tests

* Add featured as allowed param

* Fix a couple tests

* xit out test

* Update app/views/podcast_episodes/index.html.erb

* Update app/views/podcast_episodes/index.html.erb

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
2021-10-15 17:38:57 -04:00
Jamie Gaskins
34a61abdca
Remove txn from with_statement_timeout block (#15088)
Turns out this caused a *different* problem. It would work for the first
delete batch in `BulkSqlDelete`, but subsequent `DELETE` queries would
then get their `statement_timeout`s reset to the global setting. The
issue was that `BulkSqlDelete` uses methods that don't respect nested
transactions, and we were already resetting the value of the setting to
its previous value anyway, so there was really no reason to run it
inside a transaction.

The only failure mode I know of here is that the `ensure` block breaks
because `connection` is severed. In that case, the value is reset anyway
when the connection pool replaces the connection so the failure does not
propagate.
2021-10-15 14:53:35 -04:00
rhymes
abf7cf0bbd
Cleanup notifications nav menu markup (#15043)
* Use core keys instead of pluralize

* Cleanup markup and paths

* Add missing key

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

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Use regexps everywhere

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

Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>

Co-authored-by: Michael Kohl <citizen428@forem.com>
Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>
2021-10-15 18:47:39 +02:00
Jamie Gaskins
820dd9b5a6
Allow Emails::RemoveOldEmailsWorker to run longer (#15085)
* Allow Emails::RemoveOldEmailsWorker to run longer

We set the SQL statement timeout based on the STATEMENT_TIMEOUT
environment variable (defaulting to 2.5 seconds in production), but not
all SQL queries are created equal. Since some may take longer out of
necessity, this PR introduces a `Model.with_statement_timeout` method
that allows you to change the SQL statement timeout only for a given
block.

* EmailMessage doesn't inherit ApplicationRecord

It inherits from `Ahoy::Message`, which inherits directly from
`ActiveRecord::Base`.

[3] pry(main)> EmailMessage.ancestors
=> [EmailMessage(id: integer, clicked_at: datetime, content: text, feedback_message_id: integer, mailer: string, sent_at: datetime, subject: text, to: text, token: string, user_id: integer, user_type: string, utm_campaign: string, utm_content: string, utm_medium: string, utm_source: string, utm_term: string),
 EmailMessage::GeneratedAssociationMethods,
 EmailMessage::GeneratedAttributeMethods,
 Ahoy::Message(id: integer, clicked_at: datetime, content: text, feedback_message_id: integer, mailer: string, sent_at: datetime, subject: text, to: text, token: string, user_id: integer, user_type: string, utm_campaign: string, utm_content: string, utm_medium: string, utm_source: string, utm_term: string),
 Kaminari::ConfigurationMethods,
 Kaminari::ActiveRecordModelExtension,
 Ahoy::Message::GeneratedAssociationMethods,
 Ahoy::Message::GeneratedAttributeMethods,
 Bullet::SaveWithBulletSupport,
 ActiveRecord::Base,
 ...

* Use milliseconds to match STATEMENT_TIMEOUT units
2021-10-15 11:53:55 -04:00
Michael Kohl
a1f512e49e
✂✂✂ Remove events (#15062)
* Remove events

* Fix schema

* Fix specs

* More removal
2021-10-15 09:31:08 -04:00
Ben Halpern
333775b831
Admin productivity: Allow admins to unpublish all posts from a user (#15054)
* Allow admins to unpublish all posts from a user

* Update app/services/moderator/unpublish_all_articles.rb

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

* Update app/services/moderator/unpublish_all_articles.rb

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

* Update app/services/moderator/unpublish_all_articles.rb

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

* Unset `published` irrespective of front matter

* Change to worker and make other adjustments

* Fix controller test

* Fix object name

* Update app/views/admin/users/edit.html.erb

Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com>

* Update spec/requests/admin/users_spec.rb

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

Co-authored-by: Jamie Gaskins <jamie@forem.com>
Co-authored-by: Jamie Gaskins <jgaskins@hey.com>
Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com>
2021-10-15 08:56:59 +02:00
yheuhtozr
56ee3c571f
various small article elements i18n (#15023) 2021-10-15 11:06:44 +07:00
yheuhtozr
44bddb5a94
views/videos i18n (#15022)
* views/videos i18n

* remove ja.yml
2021-10-14 16:08:11 -06:00
Lewis Sparlin
ff5a94dbf3
Fix notifications not deleting because mentions already destroyed (#14987)
* Fix notifications not deleting because mentions already destroyed

* Fix spelling in spec

* Use rspec expect/to assertions for delete notification spec clarity

* resolve failing spec, and remove need for environment check 🎉
2021-10-14 09:41:10 -06:00
VISHAL DEEPAK
3964bd7983
When a user is blocked from commenting on an article, show correct error message (#15009)
* When a user is blocked from commenting on an article, show correct error message

* Created new error type ModerationUnauthorizedError and changed error text for it
2021-10-14 07:42:08 -06:00
Krystal Austin
49e1434a8c
I18nize nav_menu's list items (#15055)
* I18nize nav_menu's list items

* reverted changes to admin list item in attempt to pass the one failed test in Travis CI

* Update reading_list value

Co-authored-by: Michael Kohl <citizen428@forem.com>
2021-10-14 11:22:03 +07:00
Dan Wood
0b8338f2c6
Safari CSS gradient bug #14311 (#14938)
* Safari CSS gradient bug #14311

* Fix comments background color

* Fix scss not processing rgb with css variables
2021-10-13 17:38:55 -04:00
Kushal Niroula
595c341ce4
Fix: no title shown in comment edit page (#15066) 2021-10-13 10:54:42 -06:00
Cristien Natal
82a0035e8c
change div to aside tag and add aria-label to contain campaign banner html variant element (#15034) 2021-10-13 16:59:58 +01:00
Daniel Uber
2b3190c8b5
cleanup: replace outer scope "user" with block scoped "model" (#15065)
It's confusing why we set model as the block binding, but still access
user from the method argument (reaching outside the `tap` block).

Within this block, use model consistently to name the user.

Only change the user variable, not _user_ within methods
2021-10-13 10:44:50 -05:00
Suzanne Aitchison
7a9352ba86
make default alt text 'image description' (#15063) 2021-10-13 16:37:34 +01:00