Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into AugustasV-master
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzei committed Nov 19, 2020
2 parents 089700d + 50beb11 commit 6ba595f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/mscalendar/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package mscalendar

import (
"strings"

"github.com/pkg/errors"

"github.com/mattermost/mattermost-plugin-mscalendar/server/config"
Expand Down Expand Up @@ -81,6 +83,15 @@ func (m *mscalendar) RenewMyEventSubscription() (*store.Subscription, error) {
}
renewed, err := m.client.RenewSubscription(subscriptionID)
if err != nil {
if strings.Contains(err.Error(), "The object was not found") {
err = m.Store.DeleteUserSubscription(m.actingUser.User, subscriptionID)
if err != nil {
return nil, err
}

m.Logger.Infof("Subscription %s for Mattermost user %s has expired. Creating a new subscription now.", subscriptionID, m.actingUser.MattermostUserID)
return m.CreateMyEventSubscription()
}
return nil, err
}

Expand Down

0 comments on commit 6ba595f

Please sign in to comment.