Skip to content

Commit

Permalink
Fix author parsing to use the actual object
Browse files Browse the repository at this point in the history
CurseForge added the id as part of the data now, so we don't need to parse it.
This also broke my regex for it.
And have 202's re-sync.
  • Loading branch information
LordRalex committed Apr 19, 2023
1 parent 884ad3e commit 5511006
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions syncproject.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,10 @@ func (consumer *SyncProjectConsumer) Consume(id uint, ctx context.Context) *widg
newProps.Thumbnail = addon.Logo.ThumbnailUrl

for _, v := range addon.Authors {
var authorId uint

urls := authorIdRegex.FindStringSubmatch(v.Url)
if len(urls) < 2 {
authorId = v.Id
}
authorId = cast.ToUint(urls[1])
newProps.Members = append(newProps.Members, widget.ProjectMember{
Username: v.Name,
Title: coalesce("Owner"),
Id: authorId,
Id: v.Id,
})
}

Expand Down
2 changes: 1 addition & 1 deletion web.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func handleResolveProject(c *gin.Context, path string) {
}

//resync project if older than X time
if project.UpdatedAt.Before(time.Now().Add(-1 * time.Hour)) {
if project.UpdatedAt.Before(time.Now().Add(-1*time.Hour)) || project.Status == http.StatusAccepted {
temp := SyncProject(project.ID, ctx)
if temp != nil {
project = temp
Expand Down

0 comments on commit 5511006

Please sign in to comment.