Skip to content

Commit

Permalink
Fix list editing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Staab committed Feb 25, 2025
1 parent d28aff6 commit f35ac1d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Scan images for sensitive content
* Make muting on feeds more strict
* Apply muted words to nip05
* Fix list editing

# 0.6.5

Expand Down
30 changes: 10 additions & 20 deletions src/domain/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,17 @@ export const readUserList = (event: TrustedEvent) => {
} as PublishedUserList
}

export const createUserList = ({kind, title, description, identifier, tags}: UserList) => ({
kind,
tags: Object.entries({
...fromPairs(tags),
title,
alt: title,
d: identifier,
description: description,
}),
})
export const createUserList = ({kind, title, description, identifier, tags}: UserList) => {
const data = {title, alt: title, d: identifier, description}

export const editUserList = ({kind, title, description, identifier, tags}: UserList) => ({
kind: kind,
tags: Object.entries({
...fromPairs(tags),
title,
alt: title,
d: identifier,
description: description,
}),
})
return {kind, tags: tags.filter(t => !data[t[0]]).concat(Object.entries(data))}
}

export const editUserList = ({kind, title, description, identifier, tags}: UserList) => {
const data = {title, alt: title, d: identifier, description}

return {kind, tags: tags.filter(t => !data[t[0]]).concat(Object.entries(data))}
}

export const displayUserList = (list?: UserList) => {
if (list) {
Expand Down

0 comments on commit f35ac1d

Please sign in to comment.