Skip to content

Commit 5599eb6

Browse files
Merge branch 'develop' into iss2223-tests
2 parents e607a7a + 4e5f5da commit 5599eb6

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

controllers/users.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,14 @@ const getUserImageForVerification = async (req, res) => {
678678
const updateUser = async (req, res) => {
679679
try {
680680
const { id: profileDiffId, message } = req.body;
681-
682-
const profileDiffData = await profileDiffsQuery.fetchProfileDiffUnobfuscated(profileDiffId);
681+
const devFeatureFlag = req.query.dev;
682+
let profileDiffData;
683+
if (devFeatureFlag === "true") {
684+
profileDiffData = await profileDiffsQuery.fetchProfileDiffUnobfuscated(profileDiffId);
685+
} else {
686+
profileDiffData = await profileDiffsQuery.fetchProfileDiff(profileDiffId);
687+
}
688+
Object.freeze(profileDiffData);
683689
if (!profileDiffData) return res.boom.notFound("Profile Diff doesn't exist");
684690

685691
const { approval, timestamp, userId, ...profileDiff } = profileDiffData;

models/profileDiffs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ const fetchProfileDiffUnobfuscated = async (profileDiffId) => {
152152
...profileDiffData,
153153
};
154154
} catch (err) {
155-
logger.error("Error retrieving profile Diff", err);
155+
logger.error("Error retrieving Unobfuscated profile Diff", err);
156156
throw err;
157157
}
158158
};

models/users.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ const addOrUpdate = async (userData, userId = null) => {
9393
// user exists update user
9494
if (user.data()) {
9595
// remove id field if exist in fetched data or profileDiff
96-
const currentData = user.data();
97-
if ("id" in currentData) {
98-
delete currentData.id;
99-
}
10096
if ("id" in userData) {
10197
delete userData.id;
10298
}

0 commit comments

Comments
 (0)