Skip to content

Commit

Permalink
Merge branch 'main' into morewebhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio1988 committed Jul 22, 2023
2 parents cde5e0d + e7b0202 commit abdc4f4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion decoder/fort.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"golbat/db"
"golbat/pogo"
"golbat/webhooks"
"net/url"
)

type Location struct {
Expand Down Expand Up @@ -150,7 +151,20 @@ func CreateFortWebHooks(old *FortWebhook, new *FortWebhook, change FortChange) {
}
if !(old.ImageUrl == nil && new.ImageUrl == nil) &&
(old.ImageUrl == nil || new.ImageUrl == nil || *old.ImageUrl != *new.ImageUrl) {
editTypes = append(editTypes, "image_url")
var newPath, oldPath string
newUrl, err := url.Parse(*new.ImageUrl)
if err == nil && newUrl != nil {
newPath = newUrl.Path
}
if old.ImageUrl != nil {
oldUrl, err2 := url.Parse(*old.ImageUrl)
if err2 == nil && oldUrl != nil {
oldPath = oldUrl.Path
}
}
if oldPath != newPath {
editTypes = append(editTypes, "image_url")
}
}
if !floatAlmostEqual(old.Location.Latitude, new.Location.Latitude, floatTolerance) ||
!floatAlmostEqual(old.Location.Longitude, new.Location.Longitude, floatTolerance) {
Expand Down

0 comments on commit abdc4f4

Please sign in to comment.