fix: `LinkPreview` to json conversion

fixes: #14731
This commit is contained in:
Patryk Osmaczko 2024-05-15 09:51:46 +02:00 committed by osmaczko
parent bbd1adcabb
commit 76eda30fc1
1 changed files with 4 additions and 4 deletions

View File

@ -75,10 +75,10 @@ proc `$`*(self: LinkPreview): string =
proc `%`*(self: LinkPreview): JsonNode =
result = %* {
"url": self.url,
"standardPreview": %self.standardPreview,
"contactPreview": %self.statusContactPreview,
"communityPreview": %self.statusCommunityPreview,
"channelPreview": %self.statusCommunityChannelPreview
"standardPreview": if self.standardPreview != nil: %self.standardPreview else: newJNull(),
"contactPreview": if self.statusContactPreview != nil: %self.statusContactPreview else: newJNull(),
"communityPreview": if self.statusCommunityPreview != nil: %self.statusCommunityPreview else: newJNull(),
"channelPreview": if self.statusCommunityChannelPreview != nil: %self.statusCommunityChannelPreview else: newJNull()
}
proc empty*(self: LinkPreview): bool =