From f729e51921cdf9f52da11dc7089a0284f77eb8c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 15 Nov 2021 18:21:52 -0500 Subject: [PATCH] refactor: clone before returning --- src/social.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 () {