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

feat(emoji): allow the user to set the cdn address #3908

Merged
merged 4 commits into from
Sep 20, 2024

Conversation

imdong
Copy link
Contributor

@imdong imdong commented Oct 25, 2023

  • add cdn mirror address configuration items

Changes proposed in this pull request:

Modified extension emoji, the cdn mirror address configuration item is added to the extended emoji settings page of the management interface.
This option affects the Preview address of emoji in the Post, Reply, and Reply edit box Autocomplete.

Reviewers should focus on:

Some cdn only provide version 14.0.2 and do not provide a short address of 14, and if the user enters the wrong address, it cannot be displayed.
In addition, non-native English speakers, such as translation documents or comments unreasonable please understand

Screenshot

image

QA

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.

* add cdn mirror address configuration items
@imdong imdong requested a review from a team as a code owner October 25, 2023 15:40
@@ -0,0 +1,19 @@
import app from 'flarum/admin/app';
import {version} from "../forum/cdn";
Copy link
Member

Choose a reason for hiding this comment

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

since this is needed from both forum and admin could you please move it to common and update import paths?

@@ -30,4 +33,7 @@
}),

new Extend\Locales(__DIR__.'/locale'),

(new Extend\Settings)
->serializeToForum('flarum-emoji.cdn', 'flarum-emoji.cdn'),
Copy link
Member

Choose a reason for hiding this comment

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

let's drop the cdn const from cdn.js and instead add a default value here with that value ->default(key, value)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok,I will process it a few days later, have a nice weekend^_^

* Move cdn files to common
* add cdn default values to configuration
@imdong
Copy link
Contributor Author

imdong commented Oct 30, 2023

The cdn.js file has been moved to common , which should be done because it is common.

And the default address has been set to the default value of the configuration item, and the default setting has been removed from the js code.

But this change may have a potential problem:

The user sets up a cdn and then clears the settings to try to restore to the default configuration.

Then at this time, the page may report an error because it obtains a blank string. Of course, there is a default value from the beginning and there is no description of blank items.
However, the best solution here may be to add a' reset' button to the input box with a' default' configuration, which may be the logic of core.

# Conflicts:
#	extensions/emoji/js/src/forum/addComposerAutocomplete.js
@SychO9 SychO9 added this to the 2.0 milestone Sep 20, 2024
Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

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

Sorry for the delay! and thanks for the PR!

@imdong that's a fair point, however it's a problem with not just this setting, but a lot of settings in both core and 2nd/3rd part extensions, which hopefully can be fixed through #3935.

@SychO9 SychO9 merged commit c5b4ff7 into flarum:2.x Sep 20, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants