mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: do not append/prepend if callback returns nothing (#9778)
This commit is contained in:
@@ -32,10 +32,16 @@ function onChange(pluginApiIdentifiers, mutationFunction) {
|
||||
export function applyContentPluginApiCallbacks(content, component) {
|
||||
makeArray(component.pluginApiIdentifiers).forEach(key => {
|
||||
(_prependContentCallbacks[key] || []).forEach(c => {
|
||||
content = makeArray(c(component, content)).concat(content);
|
||||
const prependedContent = c(component, content);
|
||||
if (prependedContent) {
|
||||
content = makeArray(prependedContent).concat(content);
|
||||
}
|
||||
});
|
||||
(_appendContentCallbacks[key] || []).forEach(c => {
|
||||
content = content.concat(makeArray(c(component, content)));
|
||||
const appendedContent = c(component, content);
|
||||
if (appendedContent) {
|
||||
content = content.concat(makeArray(appendedContent));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user