From 3683076261e537699e7a6bdcae750663b0478fde Mon Sep 17 00:00:00 2001 From: Jeff Klein Date: Tue, 11 Jun 2019 09:44:10 -0700 Subject: [PATCH] do not display default attributes added to profiles --- .gitignore | 1 + v2/sunshine/user_profiles_app/assets/index.html | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7e3ac44..df2143c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.zip **/.zat **/tmp +*.swp .DS_Store diff --git a/v2/sunshine/user_profiles_app/assets/index.html b/v2/sunshine/user_profiles_app/assets/index.html index 9d0cf07..4bc5f1a 100644 --- a/v2/sunshine/user_profiles_app/assets/index.html +++ b/v2/sunshine/user_profiles_app/assets/index.html @@ -81,8 +81,21 @@ content: `${key ? profileKeyElement({ key, indentationStyle }) : ''}${value ? profileValueElement({ value, indentationStyle }): ''}` }) + const DEFAULT_ATTRIBUTES_TO_IGNORE = new Set([ + 'current_location', + 'do_not_track_location', + 'role_id', + ]) + + const filterRootKeys = depth => { + if (depth === 0) { + return key => !DEFAULT_ATTRIBUTES_TO_IGNORE.has(key) + } + return key => key + } + const renderNestedObject = (object, toId, depth = 0) => { - const keys = Object.keys(object) + const keys = Object.keys(object).filter(filterRootKeys(depth)) const indentationStyle = `margin-left:${depth * INDENT_PX}px` if (keys.length < 1) { appendElementById({