mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
refactor: clone before returning
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const _ = require('lodash');
|
||||||
const plugins = require('./plugins');
|
const plugins = require('./plugins');
|
||||||
const db = require('./database');
|
const db = require('./database');
|
||||||
|
|
||||||
@@ -9,7 +10,7 @@ social.postSharing = null;
|
|||||||
|
|
||||||
social.getPostSharing = async function () {
|
social.getPostSharing = async function () {
|
||||||
if (social.postSharing) {
|
if (social.postSharing) {
|
||||||
return social.postSharing;
|
return _.cloneDeep(social.postSharing);
|
||||||
}
|
}
|
||||||
|
|
||||||
let networks = [
|
let networks = [
|
||||||
@@ -31,7 +32,7 @@ social.getPostSharing = async function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
social.postSharing = networks;
|
social.postSharing = networks;
|
||||||
return networks;
|
return _.cloneDeep(networks);
|
||||||
};
|
};
|
||||||
|
|
||||||
social.getActivePostSharing = async function () {
|
social.getActivePostSharing = async function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user