Skip to content

Remove reimplementations of String#truncate#2073

Merged
ArtOfCode- merged 3 commits into
developfrom
art/truncate
Jun 22, 2026
Merged

Remove reimplementations of String#truncate#2073
ArtOfCode- merged 3 commits into
developfrom
art/truncate

Conversation

@ArtOfCode-

@ArtOfCode- ArtOfCode- commented Jun 22, 2026

Copy link
Copy Markdown
Member

Closes #1420.

Removes instances where we've semi-re-implemented String#truncate and uses that instead. Also deprecates ApplicationHelper#split_words_max_length in favour of the former.

Unrelated small change: adds additional environment variables for dev environments to control email settings.

@ArtOfCode- ArtOfCode- requested a review from trichoplax June 22, 2026 12:00
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.30%. Comparing base (64efa52) to head (b90badf).

Additional details and impacted files
Components Coverage Δ
controllers 76.08% <ø> (+0.03%) ⬆️
helpers 85.35% <100.00%> (+0.02%) ⬆️
jobs 74.22% <ø> (-0.89%) ⬇️
models 93.02% <ø> (ø)
tasks 61.11% <ø> (ø)

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trichoplax trichoplax left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The replacements with truncate and the deprecation of split_words_max_length look good.

I don't feel qualified to approve the email config changes so I've just made this a comment. I've added one question in case it happens to apply.

# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.delivery_method = :ses
raise_delivery_errors = ActiveRecord::Type::Boolean.new.cast(ENV['RAISE_DELIVERY_ERRORS'])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How sure are we that the ENV variable will be consistently upper or lower case (thinking of other instances in particular - can they manually change it)? Is it worth a defensive conversion to lowercase here?

In the Rails console:

:001> ActiveRecord::Type::Boolean.new.cast('False')
=> true
:002> ActiveRecord::Type::Boolean.new.cast('false')
=> false
:003> ActiveRecord::Type::Boolean.new.cast('FALSE')
=> false

It appears this is considered correct behaviour and won't be fixed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too fussed about this - it's just for quick dev reconfigurations (I used it to test the error with email sending that we're having at the moment), not long-term production config.

@ArtOfCode- ArtOfCode- merged commit e30df32 into develop Jun 22, 2026
14 checks passed
@ArtOfCode- ArtOfCode- deleted the art/truncate branch June 22, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code-only improvement: avoiding reimplementing the built in truncate method

2 participants