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 = 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)
|
||||
}
|
||||
|
||||
// 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: 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 {
|
||||
|
13
routes.go
13
routes.go
@ -153,17 +153,14 @@ func routeTopics(w http.ResponseWriter, r *http.Request, user common.User) commo
|
||||
}
|
||||
|
||||
// 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
|
||||
for _, fid := range canSee {
|
||||
forum := common.Forums.DirtyGet(fid)
|
||||
if forum.Name != "" && forum.Active {
|
||||
// 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()
|
||||
// TODO: Add a hook here for plugin_guilds
|
||||
forumList = append(forumList, fcopy)
|
||||
}
|
||||
if forum.Name != "" && forum.Active && (forum.ParentType == "" || forum.ParentType == "forum") {
|
||||
fcopy := forum.Copy()
|
||||
// TODO: Add a hook here for plugin_guilds
|
||||
forumList = append(forumList, fcopy)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user