(app *App, u *User, w http.ResponseWriter, r *http.Request)
| 857 | } |
| 858 | |
| 859 | func viewEditCollection(app *App, u *User, w http.ResponseWriter, r *http.Request) error { |
| 860 | vars := mux.Vars(r) |
| 861 | c, err := app.db.GetCollection(vars["collection"]) |
| 862 | if err != nil { |
| 863 | return err |
| 864 | } |
| 865 | if c.OwnerID != u.ID { |
| 866 | return ErrCollectionNotFound |
| 867 | } |
| 868 | |
| 869 | silenced, err := app.db.IsUserSilenced(u.ID) |
| 870 | if err != nil { |
| 871 | if err == ErrUserNotFound { |
| 872 | return err |
| 873 | } |
| 874 | log.Error("view edit collection %v", err) |
| 875 | return fmt.Errorf("view edit collection: %v", err) |
| 876 | } |
| 877 | flashes, _ := getSessionFlashes(app, w, r, nil) |
| 878 | obj := struct { |
| 879 | *UserPage |
| 880 | *Collection |
| 881 | Silenced bool |
| 882 | |
| 883 | config.EmailCfg |
| 884 | LetterReplyTo string |
| 885 | }{ |
| 886 | UserPage: NewUserPage(app, r, u, "Edit "+c.DisplayTitle(), flashes), |
| 887 | Collection: c, |
| 888 | Silenced: silenced, |
| 889 | EmailCfg: app.cfg.Email, |
| 890 | } |
| 891 | obj.UserPage.CollAlias = c.Alias |
| 892 | if obj.EmailCfg.Enabled() { |
| 893 | obj.LetterReplyTo = app.db.GetCollectionAttribute(c.ID, collAttrLetterReplyTo) |
| 894 | } |
| 895 | |
| 896 | showUserPage(w, "collection", obj) |
| 897 | return nil |
| 898 | } |
| 899 | |
| 900 | func updateSettings(app *App, w http.ResponseWriter, r *http.Request) error { |
| 901 | reqJSON := IsJSON(r) |
nothing calls this directly
no test coverage detected