Skip to content

Node.js based forum software built for the modern web

refactor: clone before returning

Barış Soner Uşaklıf729e51921cd
diff --git a/src/social.js b/src/social.js
index 1ecc9465c1..b4cb54ae22 100644
--- a/src/social.js
+++ b/src/social.js
@@ -1,5 +1,6 @@
'use strict';
+const _ = require('lodash');
const plugins = require('./plugins');
const db = require('./database');
@@ -9,7 +10,7 @@ social.postSharing = null;
social.getPostSharing = async function () {
if (social.postSharing) {
- return social.postSharing;
+ return _.cloneDeep(social.postSharing);
}
let networks = [
@@ -31,7 +32,7 @@ social.getPostSharing = async function () {
});
social.postSharing = networks;
- return networks;
+ return _.cloneDeep(networks);
};
social.getActivePostSharing = async function () {