Skip to content

Commit

Permalink
Merge pull request #118 from zendesk/jklein/filter-out-default-attrib…
Browse files Browse the repository at this point in the history
…utes

do not display default attributes added to profiles
  • Loading branch information
jeffwklein committed Jun 13, 2019
2 parents 879fba5 + 3683076 commit 37e1cbc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
*.zip
**/.zat
**/tmp
*.swp

.DS_Store
15 changes: 14 additions & 1 deletion v2/sunshine/user_profiles_app/assets/index.html
Expand Up @@ -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({
Expand Down

0 comments on commit 37e1cbc

Please sign in to comment.