Skip to content

Commit

Permalink
rename buildThumbnail func
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-sirotin committed Oct 6, 2023
1 parent 04468f7 commit e3c47db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions protocol/linkpreview_unfurler_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewStatusUnfurler(URL string, messenger *Messenger, logger *zap.Logger) *St
}
}

func buildThumbnail(image *images.IdentityImage, thumbnail *common.LinkPreviewThumbnail) error {
func updateThumbnail(image *images.IdentityImage, thumbnail *common.LinkPreviewThumbnail) error {
if image.IsEmpty() {
return nil
}
Expand Down Expand Up @@ -66,7 +66,7 @@ func (u *StatusUnfurler) buildContactData(publicKey string) (*common.StatusConta
c.Description = contact.Bio

if image, ok := contact.Images[images.SmallDimName]; ok {
if err = buildThumbnail(&image, &c.Icon); err != nil {
if err = updateThumbnail(&image, &c.Icon); err != nil {
return nil, fmt.Errorf("failed to set thumbnail: %w", err)
}
}
Expand All @@ -76,13 +76,13 @@ func (u *StatusUnfurler) buildContactData(publicKey string) (*common.StatusConta

func (u *StatusUnfurler) fillCommunityImages(community *communities.Community, icon *common.LinkPreviewThumbnail, banner *common.LinkPreviewThumbnail) error {
if image, ok := community.Images()[images.SmallDimName]; ok {
if err := buildThumbnail(&images.IdentityImage{Payload: image.Payload}, icon); err != nil {
if err := updateThumbnail(&images.IdentityImage{Payload: image.Payload}, icon); err != nil {
u.logger.Warn("unfurling status link: failed to set community thumbnail", zap.Error(err))
}
}

if image, ok := community.Images()[images.BannerIdentityName]; ok {
if err := buildThumbnail(&images.IdentityImage{Payload: image.Payload}, banner); err != nil {
if err := updateThumbnail(&images.IdentityImage{Payload: image.Payload}, banner); err != nil {
u.logger.Warn("unfurling status link: failed to set community banner", zap.Error(err))
}
}
Expand Down

0 comments on commit e3c47db

Please sign in to comment.