fix: do not try to fetch a Trello org with id "Personal"
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2024-04-09 12:40:14 +02:00
parent d686d417ae
commit ed497eeffe
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 8 additions and 4 deletions

View File

@ -425,9 +425,13 @@ func (m *Migration) Migrate(u *user.User) (err error) {
organizationMap := getTrelloOrganizationsWithBoards(boards)
for organizationID, boards := range organizationMap {
log.Debugf("[Trello Migration] Getting organization with id %s for user %d", organizationID, u.ID)
organization, err := client.GetOrganization(organizationID, trello.Defaults())
if err != nil {
return err
orgName := organizationID
if organizationID != "Personal" {
organization, err := client.GetOrganization(organizationID, trello.Defaults())
if err != nil {
return err
}
orgName = organization.DisplayName
}
for _, board := range boards {
@ -443,7 +447,7 @@ func (m *Migration) Migrate(u *user.User) (err error) {
log.Debugf("[Trello Migration] Start converting trello data for user %d for organization %s", u.ID, organizationID)
hierarchy, err := convertTrelloDataToVikunja(organization.DisplayName, boards, m.Token)
hierarchy, err := convertTrelloDataToVikunja(orgName, boards, m.Token)
if err != nil {
return err
}