MCPcopy
hub / github.com/writefreely/writefreely / handleViewSubscribers

Function handleViewSubscribers

account.go:1101–1154  ·  view source on GitHub ↗
(app *App, u *User, w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

1099}
1100
1101func handleViewSubscribers(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
1102 vars := mux.Vars(r)
1103 c, err := app.db.GetCollection(vars["collection"])
1104 if err != nil {
1105 return err
1106 }
1107
1108 filter := r.FormValue("filter")
1109
1110 flashes, _ := getSessionFlashes(app, w, r, nil)
1111 obj := struct {
1112 *UserPage
1113 Collection CollectionNav
1114 EmailSubs []*EmailSubscriber
1115 Followers *[]RemoteUser
1116 Silenced bool
1117
1118 Filter string
1119 FederationEnabled bool
1120 CanEmailSub bool
1121 CanAddSubs bool
1122 EmailSubsEnabled bool
1123 }{
1124 UserPage: NewUserPage(app, r, u, c.DisplayTitle()+" Subscribers", flashes),
1125 Collection: CollectionNav{
1126 Collection: c,
1127 Path: r.URL.Path,
1128 SingleUser: app.cfg.App.SingleUser,
1129 },
1130 Silenced: u.IsSilenced(),
1131 Filter: filter,
1132 FederationEnabled: app.cfg.App.Federation,
1133 CanEmailSub: app.cfg.Email.Enabled(),
1134 EmailSubsEnabled: c.EmailSubsEnabled(),
1135 }
1136
1137 obj.Followers, err = app.db.GetAPFollowers(c)
1138 if err != nil {
1139 return err
1140 }
1141
1142 obj.EmailSubs, err = app.db.GetEmailSubscribers(c.ID, true)
1143 if err != nil {
1144 return err
1145 }
1146
1147 if obj.Filter == "" {
1148 // Set permission to add email subscribers
1149 //obj.CanAddSubs = app.db.GetUserAttribute(c.OwnerID, userAttrCanAddEmailSubs) == "1"
1150 }
1151
1152 showUserPage(w, "subscribers", obj)
1153 return nil
1154}
1155
1156func viewSettings(app *App, u *User, w http.ResponseWriter, r *http.Request) error {
1157 fullUser, err := app.db.GetUserByID(u.ID)

Callers

nothing calls this directly

Calls 10

getSessionFlashesFunction · 0.85
NewUserPageFunction · 0.85
showUserPageFunction · 0.85
IsSilencedMethod · 0.80
EnabledMethod · 0.80
EmailSubsEnabledMethod · 0.80
GetEmailSubscribersMethod · 0.80
GetCollectionMethod · 0.65
GetAPFollowersMethod · 0.65
DisplayTitleMethod · 0.45

Tested by

no test coverage detected