MCPcopy Index your code
hub / github.com/writefreely/writefreely / handleLogOutCollection

Function handleLogOutCollection

collections.go:1440–1462  ·  view source on GitHub ↗
(app *App, w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

1438}
1439
1440func handleLogOutCollection(app *App, w http.ResponseWriter, r *http.Request) error {
1441 alias := collectionAliasFromReq(r)
1442 var c *Collection
1443 var err error
1444 if app.cfg.App.SingleUser {
1445 c, err = app.db.GetCollectionByID(1)
1446 } else {
1447 c, err = app.db.GetCollection(alias)
1448 }
1449 if err != nil {
1450 return err
1451 }
1452 if !c.IsProtected() {
1453 // Invalid to log out of this collection
1454 return ErrCollectionPageNotFound
1455 }
1456
1457 err = logOutCollection(app, c.Alias, w, r)
1458 if err != nil {
1459 addSessionFlash(app, w, r, "Logging out failed. Try clearing cookies for this site, instead.", nil)
1460 }
1461 return impart.HTTPError{http.StatusFound, c.CanonicalURL()}
1462}

Callers

nothing calls this directly

Calls 7

IsProtectedMethod · 0.95
CanonicalURLMethod · 0.95
collectionAliasFromReqFunction · 0.85
logOutCollectionFunction · 0.85
addSessionFlashFunction · 0.85
GetCollectionByIDMethod · 0.65
GetCollectionMethod · 0.65

Tested by

no test coverage detected