|
|
@@ -63,10 +63,7 @@ module.exports = class ProfileService extends Schmervice.Service {
|
|
63
|
63
|
tag => this.tagLookup[tag.tag_id],
|
|
64
|
64
|
)
|
|
65
|
65
|
const complete = new profiler.CompleteProfile(matchingProfile, true)
|
|
66
|
|
- // TODO: Refactor to use this.setDefaults(), currently does not play
|
|
67
|
|
- // nice with reveal functionality
|
|
68
|
66
|
return complete
|
|
69
|
|
- // return this.setDefaults(complete)
|
|
70
|
67
|
}
|
|
71
|
68
|
|
|
72
|
69
|
async getCompleteProfilesFor(userId, type) {
|
|
|
@@ -228,40 +225,6 @@ module.exports = class ProfileService extends Schmervice.Service {
|
|
228
|
225
|
return allResponses
|
|
229
|
226
|
}
|
|
230
|
227
|
|
|
231
|
|
- /**
|
|
232
|
|
- * Sets default profile attributes
|
|
233
|
|
- * @param {object} complete
|
|
234
|
|
- * @returns {object} updated profile
|
|
235
|
|
- */
|
|
236
|
|
- setDefaults(complete) {
|
|
237
|
|
- let defaultValues = {
|
|
238
|
|
- user_email: 'hidden@email.com',
|
|
239
|
|
- user_name: 'Hidden Name',
|
|
240
|
|
- }
|
|
241
|
|
-
|
|
242
|
|
- let defaultProfile = {
|
|
243
|
|
- ...complete,
|
|
244
|
|
- user_email: defaultValues.user_email,
|
|
245
|
|
- user_name: defaultValues.user_name,
|
|
246
|
|
- }
|
|
247
|
|
- console.log('---')
|
|
248
|
|
- console.log('defaultProfile: ', defaultProfile.user_email)
|
|
249
|
|
- if (!complete.reveal.length) return defaultProfile // nothing to reveal
|
|
250
|
|
-
|
|
251
|
|
- // swap out values of keys that are not found as complete.reveal.tag.tag_description values
|
|
252
|
|
- for (let [attribute, defaultVal] of Object.entries(defaultValues)) {
|
|
253
|
|
- if (
|
|
254
|
|
- typeof complete.reveal.find(
|
|
255
|
|
- tag => tag.tag_description == attribute,
|
|
256
|
|
- ) == 'undefined'
|
|
257
|
|
- )
|
|
258
|
|
- complete[attribute] = defaultVal
|
|
259
|
|
- }
|
|
260
|
|
- console.log('complete: ', complete.user_email)
|
|
261
|
|
-
|
|
262
|
|
- return complete
|
|
263
|
|
- }
|
|
264
|
|
-
|
|
265
|
228
|
/**
|
|
266
|
229
|
* Delete a profile
|
|
267
|
230
|
* @param {number} userId
|