Skip to content

Commit

Permalink
fix: url in StatusLinkPreivew
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-sirotin committed Sep 21, 2023
1 parent f34ec90 commit ee2c411
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion protocol/common/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ type StatusCommunityChannelLinkPreview struct {
}

type StatusLinkPreview struct {
URL string
URL string `json:"url,omitempty"`
Contact *StatusContactLinkPreview `json:"contact,omitempty"`
Community *StatusCommunityLinkPreview `json:"community,omitempty"`
Channel *StatusCommunityChannelLinkPreview `json:"channel,omitempty"`
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions protocol/linkpreview_unfurler_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (u *StatusUnfurler) createContactData(contactData *ContactURLData) *common.
func (u *StatusUnfurler) Unfurl() (common.StatusLinkPreview, error) {

var preview common.StatusLinkPreview
preview.URL = u.url

resp, err := u.m.ParseSharedURL(u.url)
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion protocol/messenger_linkpreview_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,10 @@ func (s *MessengerLinkPreviewsTestSuite) Test_UnfurlURLs_StatusContact() {
s.Require().Len(r.LinkPreviews, 0)

preview := r.StatusLinkPreviews[0]
s.Require().Equal(u, preview.URL)
s.Require().NotNil(preview.Contact)
s.Require().Equal(preview.Contact.DisplayName, c.DisplayName)
s.Require().Equal(preview.Contact.Description, "")

s.Require().Nil(preview.Community)
s.Require().Nil(preview.Channel)
}

0 comments on commit ee2c411

Please sign in to comment.