Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: getPlainContent causes external content to be fetched #3193

Merged
merged 4 commits into from
Dec 12, 2021

Conversation

imorland
Copy link
Member

@imorland imorland commented Dec 12, 2021

Changes proposed in this pull request:
getPlainContent renders the element using jQuery, which when an image is included in the content, causes this image to be fetched from the server unneccessarily.

Impact can be seen for example when a post excerpt is present, either from flarum/sticky or ianm/synopsis. If several posts are stickied, or if synopsis is enabled, many images or videos, etc are fetched.

Taking advice from @davwheat , I've refactored this util to not use jQuery at all.

Reviewers should focus on:
js is not my strong suit, this appears to work, but please let me know if I've missed something!

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)
  • Related core extension PRs: (Remove if irrelevant)

js/src/common/utils/string.ts Outdated Show resolved Hide resolved
@askvortsov1 askvortsov1 merged commit 325b9af into master Dec 12, 2021
@askvortsov1 askvortsov1 deleted the im/plaincontent branch December 12, 2021 19:30
@SychO9 SychO9 added this to the 1.2 milestone Dec 12, 2021
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.

None yet

4 participants