Fixed a bug where /topics/ always errors out for guests.
This commit is contained in:
parent
547254c4a1
commit
57ae3243f8
|
@ -175,9 +175,31 @@ func PreparseMessage(msg string) string {
|
||||||
msg = RunSshook("preparse_preassign", msg)
|
msg = RunSshook("preparse_preassign", msg)
|
||||||
}
|
}
|
||||||
msg = html.EscapeString(msg)
|
msg = html.EscapeString(msg)
|
||||||
|
/*var runes = []rune(msg)
|
||||||
|
msg = ""
|
||||||
|
//var inBold = false
|
||||||
|
//var unclosedBolds = 0
|
||||||
|
for i := 0; i < len(runes); i++ {
|
||||||
|
char := runes[i]
|
||||||
|
if char == '&' && peek(i, 1, runes) == 'l' && peek(i, 2, runes) == 't' && peek(i, 2, runes) == ';' {
|
||||||
|
i += 2
|
||||||
|
|
||||||
|
} else {
|
||||||
|
msg += string(char)
|
||||||
|
}
|
||||||
|
}*/
|
||||||
return shortcodeToUnicode(msg)
|
return shortcodeToUnicode(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Test this
|
||||||
|
// TODO: Use this elsewhere in the parser?
|
||||||
|
func peek(cur int, skip int, runes []rune) rune {
|
||||||
|
if (cur + skip) < len(runes) {
|
||||||
|
return runes[cur+skip]
|
||||||
|
}
|
||||||
|
return 0 // null byte
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Write a test for this
|
// TODO: Write a test for this
|
||||||
// TODO: We need a lot more hooks here. E.g. To add custom media types and handlers.
|
// TODO: We need a lot more hooks here. E.g. To add custom media types and handlers.
|
||||||
func ParseMessage(msg string, sectionID int, sectionType string /*, user User*/) string {
|
func ParseMessage(msg string, sectionID int, sectionType string /*, user User*/) string {
|
||||||
|
|
|
@ -153,19 +153,16 @@ func routeTopics(w http.ResponseWriter, r *http.Request, user common.User) commo
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need a list of the visible forums for Quick Topic
|
// We need a list of the visible forums for Quick Topic
|
||||||
|
// ? - Would it be useful, if we could post in social groups from /topics/?
|
||||||
var forumList []common.Forum
|
var forumList []common.Forum
|
||||||
for _, fid := range canSee {
|
for _, fid := range canSee {
|
||||||
forum := common.Forums.DirtyGet(fid)
|
forum := common.Forums.DirtyGet(fid)
|
||||||
if forum.Name != "" && forum.Active {
|
if forum.Name != "" && forum.Active && (forum.ParentType == "" || forum.ParentType == "forum") {
|
||||||
// This bit's for quick topic, as we don't want unbound forums (e.g. ones in plugin_socialgroups) showing up
|
|
||||||
// ? - Would it be useful, if we could post in social groups from /topics/?
|
|
||||||
if (forum.ParentType == "" || forum.ParentType == "forum") && user.Loggedin {
|
|
||||||
fcopy := forum.Copy()
|
fcopy := forum.Copy()
|
||||||
// TODO: Add a hook here for plugin_guilds
|
// TODO: Add a hook here for plugin_guilds
|
||||||
forumList = append(forumList, fcopy)
|
forumList = append(forumList, fcopy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// ? - Should we be showing plugin_guilds posts on /topics/?
|
// ? - Should we be showing plugin_guilds posts on /topics/?
|
||||||
argList, qlist := common.ForumListToArgQ(forumList)
|
argList, qlist := common.ForumListToArgQ(forumList)
|
||||||
|
|
Loading…
Reference in New Issue