cleanup channel settings page backend
This commit is contained in:
parent
61e4a84848
commit
dcc9bfa889
|
|
@ -362,21 +362,31 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
var page settingsPage
|
||||
page.Session = sess
|
||||
currentChannel := r.URL.Query().Get("uid")
|
||||
currentChannelUID := r.URL.Query().Get("uid")
|
||||
page.Channels, err = h.Backend.ChannelsGetList()
|
||||
page.Feeds, err = h.Backend.FollowGetList(currentChannel)
|
||||
page.Feeds, err = h.Backend.FollowGetList(currentChannelUID)
|
||||
|
||||
var selectedChannel microsub.Channel
|
||||
found := false
|
||||
|
||||
for _, v := range page.Channels {
|
||||
if v.UID == currentChannel {
|
||||
page.CurrentChannel = v
|
||||
if setting, e := h.Backend.Settings[v.UID]; e {
|
||||
if v.UID == currentChannelUID {
|
||||
selectedChannel = v
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if found {
|
||||
page.CurrentChannel = selectedChannel
|
||||
if setting, e := h.Backend.Settings[selectedChannel.UID]; e {
|
||||
page.CurrentSetting = setting
|
||||
} else {
|
||||
page.CurrentSetting = channelSetting{}
|
||||
}
|
||||
// FIXME: similar code is found in timeline.go
|
||||
if page.CurrentSetting.ChannelType == "" {
|
||||
if v.UID == "notifications" {
|
||||
if selectedChannel.UID == "notifications" {
|
||||
page.CurrentSetting.ChannelType = "stream"
|
||||
} else {
|
||||
page.CurrentSetting.ChannelType = "sorted-set"
|
||||
|
|
@ -397,8 +407,6 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
for _, v := range page.CurrentSetting.ExcludeType {
|
||||
page.ExcludedTypes[v] = true
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
err = h.renderTemplate(w, "channel.html", page)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user