Skip to content

Commit

Permalink
Add logs for revoke sharing when trashed
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed Jan 17, 2022
1 parent 1c1092a commit 1b54ee3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions model/sharing/revoke_trashed.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ func revokeTrashed(db prefixer.Prefixer, sharingID string) {
Domain: db.DomainName(),
}

log := inst.Logger().WithNamespace("sharing")
log.Infof("revokeTrashed called for sharing %s", sharingID)
if s.Owner {
err = s.Revoke(inst)
} else {
err = s.RevokeRecipientBySelf(inst, SharingDirAlreadyTrashed)
}
if err != nil {
inst.Logger().WithNamespace("sharing").
Errorf("revokeTrashed failed for sharing %s: %s", sharingID, err)
log.Errorf("revokeTrashed failed for sharing %s: %s", sharingID, err)
}
}
5 changes: 4 additions & 1 deletion model/vfs/couchdb_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,10 @@ func (c *couchdbIndexer) checkTrashedFileIsShared(doc *FileDoc) {

// RevokeSharingFunc does nothing. It will will be overridden from the sharing
// package.
var RevokeSharingFunc = func(db prefixer.Prefixer, sharingID string) {}
var RevokeSharingFunc = func(db prefixer.Prefixer, sharingID string) {
logger.WithNamespace("vfs").WithField("critical", "true").
Errorf("RevokeSharingFunc called without having been overridden!")
}

// revokeSharing is called when the main file/dir of a sharing is trashed, in
// order to revoke the sharing.
Expand Down

0 comments on commit 1b54ee3

Please sign in to comment.