Basic conversations now work, although there is still testing and UI stuff to be done.
Simplify some header script / sheet bits.
This commit is contained in:
parent
4d8c97812d
commit
f8991e089a
|
@ -10,10 +10,6 @@ import (
|
||||||
qgen "github.com/Azareal/Gosora/query_gen"
|
qgen "github.com/Azareal/Gosora/query_gen"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
|
||||||
conversations
|
|
||||||
conversations_posts
|
|
||||||
*/
|
|
||||||
var Convos ConversationStore
|
var Convos ConversationStore
|
||||||
var convoStmts ConvoStmts
|
var convoStmts ConvoStmts
|
||||||
|
|
||||||
|
@ -24,6 +20,7 @@ type ConvoStmts struct {
|
||||||
edit *sql.Stmt
|
edit *sql.Stmt
|
||||||
create *sql.Stmt
|
create *sql.Stmt
|
||||||
delete *sql.Stmt
|
delete *sql.Stmt
|
||||||
|
has *sql.Stmt
|
||||||
|
|
||||||
editPost *sql.Stmt
|
editPost *sql.Stmt
|
||||||
createPost *sql.Stmt
|
createPost *sql.Stmt
|
||||||
|
@ -38,8 +35,9 @@ func init() {
|
||||||
countPosts: acc.Count("conversations_posts").Where("cid = ?").Prepare(),
|
countPosts: acc.Count("conversations_posts").Where("cid = ?").Prepare(),
|
||||||
edit: acc.Update("conversations").Set("lastReplyBy = ?, lastReplyAt = ?").Where("cid = ?").Prepare(),
|
edit: acc.Update("conversations").Set("lastReplyBy = ?, lastReplyAt = ?").Where("cid = ?").Prepare(),
|
||||||
create: acc.Insert("conversations").Columns("createdAt, lastReplyAt").Fields("UTC_TIMESTAMP(),UTC_TIMESTAMP()").Prepare(),
|
create: acc.Insert("conversations").Columns("createdAt, lastReplyAt").Fields("UTC_TIMESTAMP(),UTC_TIMESTAMP()").Prepare(),
|
||||||
|
has: acc.Count("conversations_participants").Where("uid = ? AND cid = ?").Prepare(),
|
||||||
|
|
||||||
editPost: acc.Update("conversations_posts").Set("body = ?, post = ?").Where("cid = ?").Prepare(),
|
editPost: acc.Update("conversations_posts").Set("body = ?, post = ?").Where("pid = ?").Prepare(),
|
||||||
createPost: acc.Insert("conversations_posts").Columns("cid, body, post, createdBy").Fields("?,?,?,?").Prepare(),
|
createPost: acc.Insert("conversations_posts").Columns("cid, body, post, createdBy").Fields("?,?,?,?").Prepare(),
|
||||||
deletePost: acc.Delete("conversations_posts").Where("pid = ?").Prepare(),
|
deletePost: acc.Delete("conversations_posts").Where("pid = ?").Prepare(),
|
||||||
}
|
}
|
||||||
|
@ -86,6 +84,15 @@ func (co *Conversation) PostsCount() (count int) {
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (co *Conversation) Has(uid int) (in bool) {
|
||||||
|
var count int
|
||||||
|
err := convoStmts.has.QueryRow(uid, co.ID).Scan(&count)
|
||||||
|
if err != nil {
|
||||||
|
LogError(err)
|
||||||
|
}
|
||||||
|
return count > 0
|
||||||
|
}
|
||||||
|
|
||||||
func (co *Conversation) Update() error {
|
func (co *Conversation) Update() error {
|
||||||
_, err := convoStmts.edit.Exec(co.CreatedAt, co.LastReplyBy, co.LastReplyAt, co.ID)
|
_, err := convoStmts.edit.Exec(co.CreatedAt, co.LastReplyBy, co.LastReplyAt, co.ID)
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -106,6 +106,7 @@ type ConversationPost struct {
|
||||||
CreatedBy int
|
CreatedBy int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Should we run OnLoad on this? Or maybe add a FetchMeta method to avoid having to decode the message when it's not necessary?
|
||||||
func (co *ConversationPost) Fetch() error {
|
func (co *ConversationPost) Fetch() error {
|
||||||
return convoStmts.fetchPost.QueryRow(co.ID).Scan(&co.CID, &co.Body, &co.Post, &co.CreatedBy)
|
return convoStmts.fetchPost.QueryRow(co.ID).Scan(&co.CID, &co.Body, &co.Post, &co.CreatedBy)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,50 +51,35 @@ type Header struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Header) AddScript(name string) {
|
func (h *Header) AddScript(name string) {
|
||||||
// TODO: Use a secondary static file map to avoid this concatenation?
|
if name[0] == '/' && name[1] != '/' {
|
||||||
fname := "/s/" + name
|
// TODO: Use a secondary static file map to avoid this concatenation?
|
||||||
var oname string
|
file, ok := StaticFiles.Get("/s/" + name)
|
||||||
if fname[0] == '/' && fname[1] != '/' {
|
|
||||||
file, ok := StaticFiles.Get(fname)
|
|
||||||
if ok {
|
if ok {
|
||||||
oname = file.OName
|
name = file.OName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if oname == "" {
|
//log.Print("name:", name)
|
||||||
oname = name
|
h.Scripts = append(h.Scripts, name)
|
||||||
}
|
|
||||||
//log.Print("oname:", oname)
|
|
||||||
h.Scripts = append(h.Scripts, oname)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Header) AddPreScriptAsync(name string) {
|
func (h *Header) AddPreScriptAsync(name string) {
|
||||||
fname := "/s/" + name
|
if name[0] == '/' && name[1] != '/' {
|
||||||
var oname string
|
file, ok := StaticFiles.Get("/s/" + name)
|
||||||
if fname[0] == '/' && fname[1] != '/' {
|
|
||||||
file, ok := StaticFiles.Get(fname)
|
|
||||||
if ok {
|
if ok {
|
||||||
oname = file.OName
|
name = file.OName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if oname == "" {
|
h.PreScriptsAsync = append(h.PreScriptsAsync, name)
|
||||||
oname = name
|
|
||||||
}
|
|
||||||
h.PreScriptsAsync = append(h.PreScriptsAsync, oname)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Header) AddScriptAsync(name string) {
|
func (h *Header) AddScriptAsync(name string) {
|
||||||
fname := "/s/" + name
|
if name[0] == '/' && name[1] != '/' {
|
||||||
var oname string
|
file, ok := StaticFiles.Get("/s/" + name)
|
||||||
if fname[0] == '/' && fname[1] != '/' {
|
|
||||||
file, ok := StaticFiles.Get(fname)
|
|
||||||
if ok {
|
if ok {
|
||||||
oname = file.OName
|
name = file.OName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if oname == "" {
|
h.ScriptsAsync = append(h.ScriptsAsync, name)
|
||||||
oname = name
|
|
||||||
}
|
|
||||||
h.ScriptsAsync = append(h.ScriptsAsync, oname)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*func (h *Header) Preload(name string) {
|
/*func (h *Header) Preload(name string) {
|
||||||
|
@ -102,18 +87,13 @@ func (h *Header) AddScriptAsync(name string) {
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
func (h *Header) AddSheet(name string) {
|
func (h *Header) AddSheet(name string) {
|
||||||
fname := "/s/" + name
|
if name[0] == '/' && name[1] != '/' {
|
||||||
var oname string
|
file, ok := StaticFiles.Get("/s/" + name)
|
||||||
if fname[0] == '/' && fname[1] != '/' {
|
|
||||||
file, ok := StaticFiles.Get(fname)
|
|
||||||
if ok {
|
if ok {
|
||||||
oname = file.OName
|
name = file.OName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if oname == "" {
|
h.Stylesheets = append(h.Stylesheets, name)
|
||||||
oname = name
|
|
||||||
}
|
|
||||||
h.Stylesheets = append(h.Stylesheets, oname)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Header) AddNotice(name string) {
|
func (h *Header) AddNotice(name string) {
|
||||||
|
|
318
gen_router.go
318
gen_router.go
|
@ -129,7 +129,6 @@ var RouteMap = map[string]interface{}{
|
||||||
"routes.ConvosCreate": routes.ConvosCreate,
|
"routes.ConvosCreate": routes.ConvosCreate,
|
||||||
"routes.Convo": routes.Convo,
|
"routes.Convo": routes.Convo,
|
||||||
"routes.ConvosCreateSubmit": routes.ConvosCreateSubmit,
|
"routes.ConvosCreateSubmit": routes.ConvosCreateSubmit,
|
||||||
"routes.ConvosDeleteSubmit": routes.ConvosDeleteSubmit,
|
|
||||||
"routes.ConvosCreateReplySubmit": routes.ConvosCreateReplySubmit,
|
"routes.ConvosCreateReplySubmit": routes.ConvosCreateReplySubmit,
|
||||||
"routes.ConvosDeleteReplySubmit": routes.ConvosDeleteReplySubmit,
|
"routes.ConvosDeleteReplySubmit": routes.ConvosDeleteReplySubmit,
|
||||||
"routes.ConvosEditReplySubmit": routes.ConvosEditReplySubmit,
|
"routes.ConvosEditReplySubmit": routes.ConvosEditReplySubmit,
|
||||||
|
@ -290,57 +289,56 @@ var routeMapEnum = map[string]int{
|
||||||
"routes.ConvosCreate": 103,
|
"routes.ConvosCreate": 103,
|
||||||
"routes.Convo": 104,
|
"routes.Convo": 104,
|
||||||
"routes.ConvosCreateSubmit": 105,
|
"routes.ConvosCreateSubmit": 105,
|
||||||
"routes.ConvosDeleteSubmit": 106,
|
"routes.ConvosCreateReplySubmit": 106,
|
||||||
"routes.ConvosCreateReplySubmit": 107,
|
"routes.ConvosDeleteReplySubmit": 107,
|
||||||
"routes.ConvosDeleteReplySubmit": 108,
|
"routes.ConvosEditReplySubmit": 108,
|
||||||
"routes.ConvosEditReplySubmit": 109,
|
"routes.ViewProfile": 109,
|
||||||
"routes.ViewProfile": 110,
|
"routes.BanUserSubmit": 110,
|
||||||
"routes.BanUserSubmit": 111,
|
"routes.UnbanUser": 111,
|
||||||
"routes.UnbanUser": 112,
|
"routes.ActivateUser": 112,
|
||||||
"routes.ActivateUser": 113,
|
"routes.IPSearch": 113,
|
||||||
"routes.IPSearch": 114,
|
"routes.CreateTopicSubmit": 114,
|
||||||
"routes.CreateTopicSubmit": 115,
|
"routes.EditTopicSubmit": 115,
|
||||||
"routes.EditTopicSubmit": 116,
|
"routes.DeleteTopicSubmit": 116,
|
||||||
"routes.DeleteTopicSubmit": 117,
|
"routes.StickTopicSubmit": 117,
|
||||||
"routes.StickTopicSubmit": 118,
|
"routes.UnstickTopicSubmit": 118,
|
||||||
"routes.UnstickTopicSubmit": 119,
|
"routes.LockTopicSubmit": 119,
|
||||||
"routes.LockTopicSubmit": 120,
|
"routes.UnlockTopicSubmit": 120,
|
||||||
"routes.UnlockTopicSubmit": 121,
|
"routes.MoveTopicSubmit": 121,
|
||||||
"routes.MoveTopicSubmit": 122,
|
"routes.LikeTopicSubmit": 122,
|
||||||
"routes.LikeTopicSubmit": 123,
|
"routes.AddAttachToTopicSubmit": 123,
|
||||||
"routes.AddAttachToTopicSubmit": 124,
|
"routes.RemoveAttachFromTopicSubmit": 124,
|
||||||
"routes.RemoveAttachFromTopicSubmit": 125,
|
"routes.ViewTopic": 125,
|
||||||
"routes.ViewTopic": 126,
|
"routes.CreateReplySubmit": 126,
|
||||||
"routes.CreateReplySubmit": 127,
|
"routes.ReplyEditSubmit": 127,
|
||||||
"routes.ReplyEditSubmit": 128,
|
"routes.ReplyDeleteSubmit": 128,
|
||||||
"routes.ReplyDeleteSubmit": 129,
|
"routes.ReplyLikeSubmit": 129,
|
||||||
"routes.ReplyLikeSubmit": 130,
|
"routes.AddAttachToReplySubmit": 130,
|
||||||
"routes.AddAttachToReplySubmit": 131,
|
"routes.RemoveAttachFromReplySubmit": 131,
|
||||||
"routes.RemoveAttachFromReplySubmit": 132,
|
"routes.ProfileReplyCreateSubmit": 132,
|
||||||
"routes.ProfileReplyCreateSubmit": 133,
|
"routes.ProfileReplyEditSubmit": 133,
|
||||||
"routes.ProfileReplyEditSubmit": 134,
|
"routes.ProfileReplyDeleteSubmit": 134,
|
||||||
"routes.ProfileReplyDeleteSubmit": 135,
|
"routes.PollVote": 135,
|
||||||
"routes.PollVote": 136,
|
"routes.PollResults": 136,
|
||||||
"routes.PollResults": 137,
|
"routes.AccountLogin": 137,
|
||||||
"routes.AccountLogin": 138,
|
"routes.AccountRegister": 138,
|
||||||
"routes.AccountRegister": 139,
|
"routes.AccountLogout": 139,
|
||||||
"routes.AccountLogout": 140,
|
"routes.AccountLoginSubmit": 140,
|
||||||
"routes.AccountLoginSubmit": 141,
|
"routes.AccountLoginMFAVerify": 141,
|
||||||
"routes.AccountLoginMFAVerify": 142,
|
"routes.AccountLoginMFAVerifySubmit": 142,
|
||||||
"routes.AccountLoginMFAVerifySubmit": 143,
|
"routes.AccountRegisterSubmit": 143,
|
||||||
"routes.AccountRegisterSubmit": 144,
|
"routes.AccountPasswordReset": 144,
|
||||||
"routes.AccountPasswordReset": 145,
|
"routes.AccountPasswordResetSubmit": 145,
|
||||||
"routes.AccountPasswordResetSubmit": 146,
|
"routes.AccountPasswordResetToken": 146,
|
||||||
"routes.AccountPasswordResetToken": 147,
|
"routes.AccountPasswordResetTokenSubmit": 147,
|
||||||
"routes.AccountPasswordResetTokenSubmit": 148,
|
"routes.DynamicRoute": 148,
|
||||||
"routes.DynamicRoute": 149,
|
"routes.UploadedFile": 149,
|
||||||
"routes.UploadedFile": 150,
|
"routes.StaticFile": 150,
|
||||||
"routes.StaticFile": 151,
|
"routes.RobotsTxt": 151,
|
||||||
"routes.RobotsTxt": 152,
|
"routes.SitemapXml": 152,
|
||||||
"routes.SitemapXml": 153,
|
"routes.OpenSearchXml": 153,
|
||||||
"routes.OpenSearchXml": 154,
|
"routes.BadRoute": 154,
|
||||||
"routes.BadRoute": 155,
|
"routes.HTTPSRedirect": 155,
|
||||||
"routes.HTTPSRedirect": 156,
|
|
||||||
}
|
}
|
||||||
var reverseRouteMapEnum = map[int]string{
|
var reverseRouteMapEnum = map[int]string{
|
||||||
0: "routes.Overview",
|
0: "routes.Overview",
|
||||||
|
@ -449,57 +447,56 @@ var reverseRouteMapEnum = map[int]string{
|
||||||
103: "routes.ConvosCreate",
|
103: "routes.ConvosCreate",
|
||||||
104: "routes.Convo",
|
104: "routes.Convo",
|
||||||
105: "routes.ConvosCreateSubmit",
|
105: "routes.ConvosCreateSubmit",
|
||||||
106: "routes.ConvosDeleteSubmit",
|
106: "routes.ConvosCreateReplySubmit",
|
||||||
107: "routes.ConvosCreateReplySubmit",
|
107: "routes.ConvosDeleteReplySubmit",
|
||||||
108: "routes.ConvosDeleteReplySubmit",
|
108: "routes.ConvosEditReplySubmit",
|
||||||
109: "routes.ConvosEditReplySubmit",
|
109: "routes.ViewProfile",
|
||||||
110: "routes.ViewProfile",
|
110: "routes.BanUserSubmit",
|
||||||
111: "routes.BanUserSubmit",
|
111: "routes.UnbanUser",
|
||||||
112: "routes.UnbanUser",
|
112: "routes.ActivateUser",
|
||||||
113: "routes.ActivateUser",
|
113: "routes.IPSearch",
|
||||||
114: "routes.IPSearch",
|
114: "routes.CreateTopicSubmit",
|
||||||
115: "routes.CreateTopicSubmit",
|
115: "routes.EditTopicSubmit",
|
||||||
116: "routes.EditTopicSubmit",
|
116: "routes.DeleteTopicSubmit",
|
||||||
117: "routes.DeleteTopicSubmit",
|
117: "routes.StickTopicSubmit",
|
||||||
118: "routes.StickTopicSubmit",
|
118: "routes.UnstickTopicSubmit",
|
||||||
119: "routes.UnstickTopicSubmit",
|
119: "routes.LockTopicSubmit",
|
||||||
120: "routes.LockTopicSubmit",
|
120: "routes.UnlockTopicSubmit",
|
||||||
121: "routes.UnlockTopicSubmit",
|
121: "routes.MoveTopicSubmit",
|
||||||
122: "routes.MoveTopicSubmit",
|
122: "routes.LikeTopicSubmit",
|
||||||
123: "routes.LikeTopicSubmit",
|
123: "routes.AddAttachToTopicSubmit",
|
||||||
124: "routes.AddAttachToTopicSubmit",
|
124: "routes.RemoveAttachFromTopicSubmit",
|
||||||
125: "routes.RemoveAttachFromTopicSubmit",
|
125: "routes.ViewTopic",
|
||||||
126: "routes.ViewTopic",
|
126: "routes.CreateReplySubmit",
|
||||||
127: "routes.CreateReplySubmit",
|
127: "routes.ReplyEditSubmit",
|
||||||
128: "routes.ReplyEditSubmit",
|
128: "routes.ReplyDeleteSubmit",
|
||||||
129: "routes.ReplyDeleteSubmit",
|
129: "routes.ReplyLikeSubmit",
|
||||||
130: "routes.ReplyLikeSubmit",
|
130: "routes.AddAttachToReplySubmit",
|
||||||
131: "routes.AddAttachToReplySubmit",
|
131: "routes.RemoveAttachFromReplySubmit",
|
||||||
132: "routes.RemoveAttachFromReplySubmit",
|
132: "routes.ProfileReplyCreateSubmit",
|
||||||
133: "routes.ProfileReplyCreateSubmit",
|
133: "routes.ProfileReplyEditSubmit",
|
||||||
134: "routes.ProfileReplyEditSubmit",
|
134: "routes.ProfileReplyDeleteSubmit",
|
||||||
135: "routes.ProfileReplyDeleteSubmit",
|
135: "routes.PollVote",
|
||||||
136: "routes.PollVote",
|
136: "routes.PollResults",
|
||||||
137: "routes.PollResults",
|
137: "routes.AccountLogin",
|
||||||
138: "routes.AccountLogin",
|
138: "routes.AccountRegister",
|
||||||
139: "routes.AccountRegister",
|
139: "routes.AccountLogout",
|
||||||
140: "routes.AccountLogout",
|
140: "routes.AccountLoginSubmit",
|
||||||
141: "routes.AccountLoginSubmit",
|
141: "routes.AccountLoginMFAVerify",
|
||||||
142: "routes.AccountLoginMFAVerify",
|
142: "routes.AccountLoginMFAVerifySubmit",
|
||||||
143: "routes.AccountLoginMFAVerifySubmit",
|
143: "routes.AccountRegisterSubmit",
|
||||||
144: "routes.AccountRegisterSubmit",
|
144: "routes.AccountPasswordReset",
|
||||||
145: "routes.AccountPasswordReset",
|
145: "routes.AccountPasswordResetSubmit",
|
||||||
146: "routes.AccountPasswordResetSubmit",
|
146: "routes.AccountPasswordResetToken",
|
||||||
147: "routes.AccountPasswordResetToken",
|
147: "routes.AccountPasswordResetTokenSubmit",
|
||||||
148: "routes.AccountPasswordResetTokenSubmit",
|
148: "routes.DynamicRoute",
|
||||||
149: "routes.DynamicRoute",
|
149: "routes.UploadedFile",
|
||||||
150: "routes.UploadedFile",
|
150: "routes.StaticFile",
|
||||||
151: "routes.StaticFile",
|
151: "routes.RobotsTxt",
|
||||||
152: "routes.RobotsTxt",
|
152: "routes.SitemapXml",
|
||||||
153: "routes.SitemapXml",
|
153: "routes.OpenSearchXml",
|
||||||
154: "routes.OpenSearchXml",
|
154: "routes.BadRoute",
|
||||||
155: "routes.BadRoute",
|
155: "routes.HTTPSRedirect",
|
||||||
156: "routes.HTTPSRedirect",
|
|
||||||
}
|
}
|
||||||
var osMapEnum = map[string]int{
|
var osMapEnum = map[string]int{
|
||||||
"unknown": 0,
|
"unknown": 0,
|
||||||
|
@ -657,7 +654,7 @@ type HTTPSRedirect struct {}
|
||||||
|
|
||||||
func (red *HTTPSRedirect) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
func (red *HTTPSRedirect) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
w.Header().Set("Connection", "close")
|
w.Header().Set("Connection", "close")
|
||||||
counters.RouteViewCounter.Bump(156)
|
counters.RouteViewCounter.Bump(155)
|
||||||
dest := "https://" + req.Host + req.URL.String()
|
dest := "https://" + req.Host + req.URL.String()
|
||||||
http.Redirect(w, req, dest, http.StatusTemporaryRedirect)
|
http.Redirect(w, req, dest, http.StatusTemporaryRedirect)
|
||||||
}
|
}
|
||||||
|
@ -866,7 +863,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
counters.GlobalViewCounter.Bump()
|
counters.GlobalViewCounter.Bump()
|
||||||
|
|
||||||
if prefix == "/s" { //old prefix: /static
|
if prefix == "/s" { //old prefix: /static
|
||||||
counters.RouteViewCounter.Bump(151)
|
counters.RouteViewCounter.Bump(150)
|
||||||
req.URL.Path += extraData
|
req.URL.Path += extraData
|
||||||
routes.StaticFile(w, req)
|
routes.StaticFile(w, req)
|
||||||
return
|
return
|
||||||
|
@ -1893,19 +1890,6 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(105)
|
counters.RouteViewCounter.Bump(105)
|
||||||
err = routes.ConvosCreateSubmit(w,req,user)
|
err = routes.ConvosCreateSubmit(w,req,user)
|
||||||
case "/user/convos/delete/submit/":
|
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = c.MemberOnly(w,req,user)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(106)
|
|
||||||
err = routes.ConvosDeleteSubmit(w,req,user,extraData)
|
|
||||||
case "/user/convo/create/submit/":
|
case "/user/convo/create/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1917,8 +1901,8 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(107)
|
counters.RouteViewCounter.Bump(106)
|
||||||
err = routes.ConvosCreateReplySubmit(w,req,user)
|
err = routes.ConvosCreateReplySubmit(w,req,user,extraData)
|
||||||
case "/user/convo/delete/submit/":
|
case "/user/convo/delete/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1930,7 +1914,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(108)
|
counters.RouteViewCounter.Bump(107)
|
||||||
err = routes.ConvosDeleteReplySubmit(w,req,user,extraData)
|
err = routes.ConvosDeleteReplySubmit(w,req,user,extraData)
|
||||||
case "/user/convo/edit/submit/":
|
case "/user/convo/edit/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -1943,11 +1927,11 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(109)
|
counters.RouteViewCounter.Bump(108)
|
||||||
err = routes.ConvosEditReplySubmit(w,req,user,extraData)
|
err = routes.ConvosEditReplySubmit(w,req,user,extraData)
|
||||||
default:
|
default:
|
||||||
req.URL.Path += extraData
|
req.URL.Path += extraData
|
||||||
counters.RouteViewCounter.Bump(110)
|
counters.RouteViewCounter.Bump(109)
|
||||||
head, err := c.UserCheck(w,req,&user)
|
head, err := c.UserCheck(w,req,&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -1967,7 +1951,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(111)
|
counters.RouteViewCounter.Bump(110)
|
||||||
err = routes.BanUserSubmit(w,req,user,extraData)
|
err = routes.BanUserSubmit(w,req,user,extraData)
|
||||||
case "/users/unban/":
|
case "/users/unban/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -1980,7 +1964,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(112)
|
counters.RouteViewCounter.Bump(111)
|
||||||
err = routes.UnbanUser(w,req,user,extraData)
|
err = routes.UnbanUser(w,req,user,extraData)
|
||||||
case "/users/activate/":
|
case "/users/activate/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -1993,7 +1977,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(113)
|
counters.RouteViewCounter.Bump(112)
|
||||||
err = routes.ActivateUser(w,req,user,extraData)
|
err = routes.ActivateUser(w,req,user,extraData)
|
||||||
case "/users/ips/":
|
case "/users/ips/":
|
||||||
err = c.MemberOnly(w,req,user)
|
err = c.MemberOnly(w,req,user)
|
||||||
|
@ -2001,7 +1985,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(114)
|
counters.RouteViewCounter.Bump(113)
|
||||||
head, err := c.UserCheck(w,req,&user)
|
head, err := c.UserCheck(w,req,&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -2025,7 +2009,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(115)
|
counters.RouteViewCounter.Bump(114)
|
||||||
err = routes.CreateTopicSubmit(w,req,user)
|
err = routes.CreateTopicSubmit(w,req,user)
|
||||||
case "/topic/edit/submit/":
|
case "/topic/edit/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2038,7 +2022,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(116)
|
counters.RouteViewCounter.Bump(115)
|
||||||
err = routes.EditTopicSubmit(w,req,user,extraData)
|
err = routes.EditTopicSubmit(w,req,user,extraData)
|
||||||
case "/topic/delete/submit/":
|
case "/topic/delete/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2052,7 +2036,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
}
|
}
|
||||||
|
|
||||||
req.URL.Path += extraData
|
req.URL.Path += extraData
|
||||||
counters.RouteViewCounter.Bump(117)
|
counters.RouteViewCounter.Bump(116)
|
||||||
err = routes.DeleteTopicSubmit(w,req,user)
|
err = routes.DeleteTopicSubmit(w,req,user)
|
||||||
case "/topic/stick/submit/":
|
case "/topic/stick/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2065,7 +2049,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(118)
|
counters.RouteViewCounter.Bump(117)
|
||||||
err = routes.StickTopicSubmit(w,req,user,extraData)
|
err = routes.StickTopicSubmit(w,req,user,extraData)
|
||||||
case "/topic/unstick/submit/":
|
case "/topic/unstick/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2078,7 +2062,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(119)
|
counters.RouteViewCounter.Bump(118)
|
||||||
err = routes.UnstickTopicSubmit(w,req,user,extraData)
|
err = routes.UnstickTopicSubmit(w,req,user,extraData)
|
||||||
case "/topic/lock/submit/":
|
case "/topic/lock/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2092,7 +2076,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
}
|
}
|
||||||
|
|
||||||
req.URL.Path += extraData
|
req.URL.Path += extraData
|
||||||
counters.RouteViewCounter.Bump(120)
|
counters.RouteViewCounter.Bump(119)
|
||||||
err = routes.LockTopicSubmit(w,req,user)
|
err = routes.LockTopicSubmit(w,req,user)
|
||||||
case "/topic/unlock/submit/":
|
case "/topic/unlock/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2105,7 +2089,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(121)
|
counters.RouteViewCounter.Bump(120)
|
||||||
err = routes.UnlockTopicSubmit(w,req,user,extraData)
|
err = routes.UnlockTopicSubmit(w,req,user,extraData)
|
||||||
case "/topic/move/submit/":
|
case "/topic/move/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2118,7 +2102,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(122)
|
counters.RouteViewCounter.Bump(121)
|
||||||
err = routes.MoveTopicSubmit(w,req,user,extraData)
|
err = routes.MoveTopicSubmit(w,req,user,extraData)
|
||||||
case "/topic/like/submit/":
|
case "/topic/like/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2131,7 +2115,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(123)
|
counters.RouteViewCounter.Bump(122)
|
||||||
err = routes.LikeTopicSubmit(w,req,user,extraData)
|
err = routes.LikeTopicSubmit(w,req,user,extraData)
|
||||||
case "/topic/attach/add/submit/":
|
case "/topic/attach/add/submit/":
|
||||||
err = c.MemberOnly(w,req,user)
|
err = c.MemberOnly(w,req,user)
|
||||||
|
@ -2148,7 +2132,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(124)
|
counters.RouteViewCounter.Bump(123)
|
||||||
err = routes.AddAttachToTopicSubmit(w,req,user,extraData)
|
err = routes.AddAttachToTopicSubmit(w,req,user,extraData)
|
||||||
case "/topic/attach/remove/submit/":
|
case "/topic/attach/remove/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2161,10 +2145,10 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(125)
|
counters.RouteViewCounter.Bump(124)
|
||||||
err = routes.RemoveAttachFromTopicSubmit(w,req,user,extraData)
|
err = routes.RemoveAttachFromTopicSubmit(w,req,user,extraData)
|
||||||
default:
|
default:
|
||||||
counters.RouteViewCounter.Bump(126)
|
counters.RouteViewCounter.Bump(125)
|
||||||
head, err := c.UserCheck(w,req,&user)
|
head, err := c.UserCheck(w,req,&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -2188,7 +2172,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(127)
|
counters.RouteViewCounter.Bump(126)
|
||||||
err = routes.CreateReplySubmit(w,req,user)
|
err = routes.CreateReplySubmit(w,req,user)
|
||||||
case "/reply/edit/submit/":
|
case "/reply/edit/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2201,7 +2185,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(128)
|
counters.RouteViewCounter.Bump(127)
|
||||||
err = routes.ReplyEditSubmit(w,req,user,extraData)
|
err = routes.ReplyEditSubmit(w,req,user,extraData)
|
||||||
case "/reply/delete/submit/":
|
case "/reply/delete/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2214,7 +2198,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(129)
|
counters.RouteViewCounter.Bump(128)
|
||||||
err = routes.ReplyDeleteSubmit(w,req,user,extraData)
|
err = routes.ReplyDeleteSubmit(w,req,user,extraData)
|
||||||
case "/reply/like/submit/":
|
case "/reply/like/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2227,7 +2211,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(130)
|
counters.RouteViewCounter.Bump(129)
|
||||||
err = routes.ReplyLikeSubmit(w,req,user,extraData)
|
err = routes.ReplyLikeSubmit(w,req,user,extraData)
|
||||||
case "/reply/attach/add/submit/":
|
case "/reply/attach/add/submit/":
|
||||||
err = c.MemberOnly(w,req,user)
|
err = c.MemberOnly(w,req,user)
|
||||||
|
@ -2244,7 +2228,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(131)
|
counters.RouteViewCounter.Bump(130)
|
||||||
err = routes.AddAttachToReplySubmit(w,req,user,extraData)
|
err = routes.AddAttachToReplySubmit(w,req,user,extraData)
|
||||||
case "/reply/attach/remove/submit/":
|
case "/reply/attach/remove/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2257,7 +2241,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(132)
|
counters.RouteViewCounter.Bump(131)
|
||||||
err = routes.RemoveAttachFromReplySubmit(w,req,user,extraData)
|
err = routes.RemoveAttachFromReplySubmit(w,req,user,extraData)
|
||||||
}
|
}
|
||||||
case "/profile":
|
case "/profile":
|
||||||
|
@ -2273,7 +2257,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(133)
|
counters.RouteViewCounter.Bump(132)
|
||||||
err = routes.ProfileReplyCreateSubmit(w,req,user)
|
err = routes.ProfileReplyCreateSubmit(w,req,user)
|
||||||
case "/profile/reply/edit/submit/":
|
case "/profile/reply/edit/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2286,7 +2270,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(134)
|
counters.RouteViewCounter.Bump(133)
|
||||||
err = routes.ProfileReplyEditSubmit(w,req,user,extraData)
|
err = routes.ProfileReplyEditSubmit(w,req,user,extraData)
|
||||||
case "/profile/reply/delete/submit/":
|
case "/profile/reply/delete/submit/":
|
||||||
err = c.NoSessionMismatch(w,req,user)
|
err = c.NoSessionMismatch(w,req,user)
|
||||||
|
@ -2299,7 +2283,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(135)
|
counters.RouteViewCounter.Bump(134)
|
||||||
err = routes.ProfileReplyDeleteSubmit(w,req,user,extraData)
|
err = routes.ProfileReplyDeleteSubmit(w,req,user,extraData)
|
||||||
}
|
}
|
||||||
case "/poll":
|
case "/poll":
|
||||||
|
@ -2315,23 +2299,23 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(136)
|
counters.RouteViewCounter.Bump(135)
|
||||||
err = routes.PollVote(w,req,user,extraData)
|
err = routes.PollVote(w,req,user,extraData)
|
||||||
case "/poll/results/":
|
case "/poll/results/":
|
||||||
counters.RouteViewCounter.Bump(137)
|
counters.RouteViewCounter.Bump(136)
|
||||||
err = routes.PollResults(w,req,user,extraData)
|
err = routes.PollResults(w,req,user,extraData)
|
||||||
}
|
}
|
||||||
case "/accounts":
|
case "/accounts":
|
||||||
switch(req.URL.Path) {
|
switch(req.URL.Path) {
|
||||||
case "/accounts/login/":
|
case "/accounts/login/":
|
||||||
counters.RouteViewCounter.Bump(138)
|
counters.RouteViewCounter.Bump(137)
|
||||||
head, err := c.UserCheck(w,req,&user)
|
head, err := c.UserCheck(w,req,&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = routes.AccountLogin(w,req,user,head)
|
err = routes.AccountLogin(w,req,user,head)
|
||||||
case "/accounts/create/":
|
case "/accounts/create/":
|
||||||
counters.RouteViewCounter.Bump(139)
|
counters.RouteViewCounter.Bump(138)
|
||||||
head, err := c.UserCheck(w,req,&user)
|
head, err := c.UserCheck(w,req,&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -2348,7 +2332,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(140)
|
counters.RouteViewCounter.Bump(139)
|
||||||
err = routes.AccountLogout(w,req,user)
|
err = routes.AccountLogout(w,req,user)
|
||||||
case "/accounts/login/submit/":
|
case "/accounts/login/submit/":
|
||||||
err = c.ParseForm(w,req,user)
|
err = c.ParseForm(w,req,user)
|
||||||
|
@ -2356,10 +2340,10 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(141)
|
counters.RouteViewCounter.Bump(140)
|
||||||
err = routes.AccountLoginSubmit(w,req,user)
|
err = routes.AccountLoginSubmit(w,req,user)
|
||||||
case "/accounts/mfa_verify/":
|
case "/accounts/mfa_verify/":
|
||||||
counters.RouteViewCounter.Bump(142)
|
counters.RouteViewCounter.Bump(141)
|
||||||
head, err := c.UserCheck(w,req,&user)
|
head, err := c.UserCheck(w,req,&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -2371,7 +2355,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(143)
|
counters.RouteViewCounter.Bump(142)
|
||||||
err = routes.AccountLoginMFAVerifySubmit(w,req,user)
|
err = routes.AccountLoginMFAVerifySubmit(w,req,user)
|
||||||
case "/accounts/create/submit/":
|
case "/accounts/create/submit/":
|
||||||
err = c.ParseForm(w,req,user)
|
err = c.ParseForm(w,req,user)
|
||||||
|
@ -2379,10 +2363,10 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(144)
|
counters.RouteViewCounter.Bump(143)
|
||||||
err = routes.AccountRegisterSubmit(w,req,user)
|
err = routes.AccountRegisterSubmit(w,req,user)
|
||||||
case "/accounts/password-reset/":
|
case "/accounts/password-reset/":
|
||||||
counters.RouteViewCounter.Bump(145)
|
counters.RouteViewCounter.Bump(144)
|
||||||
head, err := c.UserCheck(w,req,&user)
|
head, err := c.UserCheck(w,req,&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -2394,10 +2378,10 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(146)
|
counters.RouteViewCounter.Bump(145)
|
||||||
err = routes.AccountPasswordResetSubmit(w,req,user)
|
err = routes.AccountPasswordResetSubmit(w,req,user)
|
||||||
case "/accounts/password-reset/token/":
|
case "/accounts/password-reset/token/":
|
||||||
counters.RouteViewCounter.Bump(147)
|
counters.RouteViewCounter.Bump(146)
|
||||||
head, err := c.UserCheck(w,req,&user)
|
head, err := c.UserCheck(w,req,&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -2409,7 +2393,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
counters.RouteViewCounter.Bump(148)
|
counters.RouteViewCounter.Bump(147)
|
||||||
err = routes.AccountPasswordResetTokenSubmit(w,req,user)
|
err = routes.AccountPasswordResetTokenSubmit(w,req,user)
|
||||||
}
|
}
|
||||||
/*case "/sitemaps": // TODO: Count these views
|
/*case "/sitemaps": // TODO: Count these views
|
||||||
|
@ -2426,7 +2410,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
h.Del("Content-Type")
|
h.Del("Content-Type")
|
||||||
h.Del("Content-Encoding")
|
h.Del("Content-Encoding")
|
||||||
}
|
}
|
||||||
counters.RouteViewCounter.Bump(150)
|
counters.RouteViewCounter.Bump(149)
|
||||||
req.URL.Path += extraData
|
req.URL.Path += extraData
|
||||||
// TODO: Find a way to propagate errors up from this?
|
// TODO: Find a way to propagate errors up from this?
|
||||||
r.UploadHandler(w,req) // TODO: Count these views
|
r.UploadHandler(w,req) // TODO: Count these views
|
||||||
|
@ -2436,7 +2420,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
// TODO: Add support for favicons and robots.txt files
|
// TODO: Add support for favicons and robots.txt files
|
||||||
switch(extraData) {
|
switch(extraData) {
|
||||||
case "robots.txt":
|
case "robots.txt":
|
||||||
counters.RouteViewCounter.Bump(152)
|
counters.RouteViewCounter.Bump(151)
|
||||||
return routes.RobotsTxt(w,req)
|
return routes.RobotsTxt(w,req)
|
||||||
case "favicon.ico":
|
case "favicon.ico":
|
||||||
gzw, ok := w.(c.GzipResponseWriter)
|
gzw, ok := w.(c.GzipResponseWriter)
|
||||||
|
@ -2450,10 +2434,10 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
routes.StaticFile(w,req)
|
routes.StaticFile(w,req)
|
||||||
return nil
|
return nil
|
||||||
case "opensearch.xml":
|
case "opensearch.xml":
|
||||||
counters.RouteViewCounter.Bump(154)
|
counters.RouteViewCounter.Bump(153)
|
||||||
return routes.OpenSearchXml(w,req)
|
return routes.OpenSearchXml(w,req)
|
||||||
/*case "sitemap.xml":
|
/*case "sitemap.xml":
|
||||||
counters.RouteViewCounter.Bump(153)
|
counters.RouteViewCounter.Bump(152)
|
||||||
return routes.SitemapXml(w,req)*/
|
return routes.SitemapXml(w,req)*/
|
||||||
}
|
}
|
||||||
return c.NotFound(w,req,nil)
|
return c.NotFound(w,req,nil)
|
||||||
|
@ -2464,7 +2448,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
r.RUnlock()
|
r.RUnlock()
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
counters.RouteViewCounter.Bump(149) // TODO: Be more specific about *which* dynamic route it is
|
counters.RouteViewCounter.Bump(148) // TODO: Be more specific about *which* dynamic route it is
|
||||||
req.URL.Path += extraData
|
req.URL.Path += extraData
|
||||||
return handle(w,req,user)
|
return handle(w,req,user)
|
||||||
}
|
}
|
||||||
|
@ -2475,7 +2459,7 @@ func (r *GenRouter) routeSwitch(w http.ResponseWriter, req *http.Request, user c
|
||||||
} else {
|
} else {
|
||||||
r.DumpRequest(req,"Bad Route")
|
r.DumpRequest(req,"Bad Route")
|
||||||
}
|
}
|
||||||
counters.RouteViewCounter.Bump(155)
|
counters.RouteViewCounter.Bump(154)
|
||||||
return c.NotFound(w,req,nil)
|
return c.NotFound(w,req,nil)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -87,8 +87,8 @@ func userRoutes() *RouteGroup {
|
||||||
MView("routes.ConvosCreate", "/user/convos/create/"),
|
MView("routes.ConvosCreate", "/user/convos/create/"),
|
||||||
MView("routes.Convo", "/user/convo/", "extraData"),
|
MView("routes.Convo", "/user/convo/", "extraData"),
|
||||||
Action("routes.ConvosCreateSubmit", "/user/convos/create/submit/"),
|
Action("routes.ConvosCreateSubmit", "/user/convos/create/submit/"),
|
||||||
Action("routes.ConvosDeleteSubmit", "/user/convos/delete/submit/", "extraData"),
|
//Action("routes.ConvosDeleteSubmit", "/user/convos/delete/submit/", "extraData"),
|
||||||
Action("routes.ConvosCreateReplySubmit", "/user/convo/create/submit/"),
|
Action("routes.ConvosCreateReplySubmit", "/user/convo/create/submit/","extraData"),
|
||||||
Action("routes.ConvosDeleteReplySubmit", "/user/convo/delete/submit/","extraData"),
|
Action("routes.ConvosDeleteReplySubmit", "/user/convo/delete/submit/","extraData"),
|
||||||
Action("routes.ConvosEditReplySubmit", "/user/convo/edit/submit/", "extraData"),
|
Action("routes.ConvosEditReplySubmit", "/user/convo/edit/submit/", "extraData"),
|
||||||
)
|
)
|
||||||
|
|
|
@ -88,6 +88,9 @@ func ConvosCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.R
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
|
if user.IsBanned {
|
||||||
|
return c.NoPermissions(w,r,user)
|
||||||
|
}
|
||||||
|
|
||||||
recps := c.SanitiseSingleLine(r.PostFormValue("recp"))
|
recps := c.SanitiseSingleLine(r.PostFormValue("recp"))
|
||||||
body := c.PreparseMessage(r.PostFormValue("body"))
|
body := c.PreparseMessage(r.PostFormValue("body"))
|
||||||
|
@ -117,7 +120,7 @@ func ConvosCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.R
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ConvosDeleteSubmit(w http.ResponseWriter, r *http.Request, user c.User, scid string) c.RouteError {
|
/*func ConvosDeleteSubmit(w http.ResponseWriter, r *http.Request, user c.User, scid string) c.RouteError {
|
||||||
_, ferr := c.SimpleUserCheck(w, r, &user)
|
_, ferr := c.SimpleUserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
|
@ -134,14 +137,43 @@ func ConvosDeleteSubmit(w http.ResponseWriter, r *http.Request, user c.User, sci
|
||||||
|
|
||||||
http.Redirect(w, r, "/user/convos/", http.StatusSeeOther)
|
http.Redirect(w, r, "/user/convos/", http.StatusSeeOther)
|
||||||
return nil
|
return nil
|
||||||
}
|
}*/
|
||||||
|
|
||||||
func ConvosCreateReplySubmit(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
|
func ConvosCreateReplySubmit(w http.ResponseWriter, r *http.Request, user c.User, scid string) c.RouteError {
|
||||||
_, ferr := c.SimpleUserCheck(w, r, &user)
|
_, ferr := c.SimpleUserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
http.Redirect(w, r, "/user/convo/id", http.StatusSeeOther)
|
if user.IsBanned {
|
||||||
|
return c.NoPermissions(w,r,user)
|
||||||
|
}
|
||||||
|
cid, err := strconv.Atoi(scid)
|
||||||
|
if err != nil {
|
||||||
|
return c.LocalError(p.GetErrorPhrase("id_must_be_integer"), w, r, user)
|
||||||
|
}
|
||||||
|
|
||||||
|
convo, err := c.Convos.Get(cid)
|
||||||
|
if err == sql.ErrNoRows {
|
||||||
|
return c.NotFound(w, r, nil)
|
||||||
|
} else if err != nil {
|
||||||
|
return c.InternalError(err, w, r)
|
||||||
|
}
|
||||||
|
pcount := convo.PostsCount()
|
||||||
|
if pcount == 0 {
|
||||||
|
return c.NotFound(w, r, nil)
|
||||||
|
}
|
||||||
|
if !convo.Has(user.ID) {
|
||||||
|
return c.LocalError("You are not in this conversation.",w,r,user)
|
||||||
|
}
|
||||||
|
|
||||||
|
body := c.PreparseMessage(r.PostFormValue("content"))
|
||||||
|
post := &c.ConversationPost{CID: cid, Body: body, CreatedBy: user.ID}
|
||||||
|
_, err = post.Create()
|
||||||
|
if err != nil {
|
||||||
|
return c.InternalError(err, w, r)
|
||||||
|
}
|
||||||
|
|
||||||
|
http.Redirect(w, r, "/user/convo/" + strconv.Itoa(convo.ID), http.StatusSeeOther)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +205,9 @@ func ConvosDeleteReplySubmit(w http.ResponseWriter, r *http.Request, user c.User
|
||||||
if pcount == 0 {
|
if pcount == 0 {
|
||||||
return c.NotFound(w, r, nil)
|
return c.NotFound(w, r, nil)
|
||||||
}
|
}
|
||||||
|
if user.ID != convo.CreatedBy && !user.IsSuperMod {
|
||||||
|
return c.NoPermissions(w,r,user)
|
||||||
|
}
|
||||||
|
|
||||||
posts, err := convo.Posts(0, c.Config.ItemsPerPage)
|
posts, err := convo.Posts(0, c.Config.ItemsPerPage)
|
||||||
// TODO: Report a better error for no posts
|
// TODO: Report a better error for no posts
|
||||||
|
@ -200,6 +235,44 @@ func ConvosEditReplySubmit(w http.ResponseWriter, r *http.Request, user c.User,
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
http.Redirect(w, r, "/user/convo/id", http.StatusSeeOther)
|
cpid, err := strconv.Atoi(scpid)
|
||||||
|
if err != nil {
|
||||||
|
return c.LocalError(p.GetErrorPhrase("id_must_be_integer"), w, r, user)
|
||||||
|
}
|
||||||
|
isJs := (r.PostFormValue("js") == "1")
|
||||||
|
|
||||||
|
post := &c.ConversationPost{ID: cpid}
|
||||||
|
err = post.Fetch()
|
||||||
|
if err == sql.ErrNoRows {
|
||||||
|
return c.NotFound(w, r, nil)
|
||||||
|
} else if err != nil {
|
||||||
|
return c.InternalError(err, w, r)
|
||||||
|
}
|
||||||
|
|
||||||
|
convo, err := c.Convos.Get(post.CID)
|
||||||
|
if err == sql.ErrNoRows {
|
||||||
|
return c.NotFound(w, r, nil)
|
||||||
|
} else if err != nil {
|
||||||
|
return c.InternalError(err, w, r)
|
||||||
|
}
|
||||||
|
pcount := convo.PostsCount()
|
||||||
|
if pcount == 0 {
|
||||||
|
return c.NotFound(w, r, nil)
|
||||||
|
}
|
||||||
|
if user.ID != convo.CreatedBy && !user.IsSuperMod {
|
||||||
|
return c.NoPermissions(w,r,user)
|
||||||
|
}
|
||||||
|
|
||||||
|
post.Body = c.PreparseMessage(r.PostFormValue("edit_item"))
|
||||||
|
err = post.Update()
|
||||||
|
if err != nil {
|
||||||
|
return c.InternalError(err, w, r)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isJs {
|
||||||
|
http.Redirect(w, r, "/user/convo/"+strconv.Itoa(post.CID), http.StatusSeeOther)
|
||||||
|
} else {
|
||||||
|
w.Write(successJSONBytes)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ func ForumsOrderSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.Ro
|
||||||
sitems := strings.TrimSuffix(strings.TrimPrefix(r.PostFormValue("items"), "{"), "}")
|
sitems := strings.TrimSuffix(strings.TrimPrefix(r.PostFormValue("items"), "{"), "}")
|
||||||
//fmt.Printf("sitems: %+v\n", sitems)
|
//fmt.Printf("sitems: %+v\n", sitems)
|
||||||
|
|
||||||
var updateMap = make(map[int]int)
|
updateMap := make(map[int]int)
|
||||||
for index, sfid := range strings.Split(sitems, ",") {
|
for index, sfid := range strings.Split(sitems, ",") {
|
||||||
fid, err := strconv.Atoi(sfid)
|
fid, err := strconv.Atoi(sfid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -237,7 +237,7 @@ func ForumsEditSubmit(w http.ResponseWriter, r *http.Request, user c.User, sfid
|
||||||
forumPreset := c.StripInvalidPreset(r.PostFormValue("forum_preset"))
|
forumPreset := c.StripInvalidPreset(r.PostFormValue("forum_preset"))
|
||||||
forumActive := r.PostFormValue("forum_active")
|
forumActive := r.PostFormValue("forum_active")
|
||||||
|
|
||||||
var active = false
|
active := false
|
||||||
if forumActive == "" {
|
if forumActive == "" {
|
||||||
active = forum.Active
|
active = forum.Active
|
||||||
} else if forumActive == "1" || forumActive == "Show" {
|
} else if forumActive == "1" || forumActive == "Show" {
|
||||||
|
|
|
@ -3,4 +3,16 @@
|
||||||
<h1>{{lang "convo_head"}}</h1>
|
<h1>{{lang "convo_head"}}</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="colstack_item hash_hide">{{template "convo_row.html" . }}</div>
|
<div class="colstack_item hash_hide">{{template "convo_row.html" . }}</div>
|
||||||
|
{{if not .CurrentUser.IsBanned}}
|
||||||
|
<form action="/user/convo/create/submit/{{.Convo.ID}}?s={{.CurrentUser.Session}}" method="post">
|
||||||
|
<div class="colstack_item topic_reply_form" style="border-top:none;">
|
||||||
|
<div class="formrow">
|
||||||
|
<div class="formitem"><textarea class="input_content" name="content" placeholder="{{lang "profile_comments_form_content"}}"></textarea></div>
|
||||||
|
</div>
|
||||||
|
<div class="formrow quick_button_row">
|
||||||
|
<div class="formitem"><button name="reply-button" class="formbutton">{{lang "profile_comments_form_button"}}</button></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{{end}}
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="colstack_item colstack_head rowhead">
|
<div class="colstack_item colstack_head rowhead">
|
||||||
<div class="rowitem">
|
<div class="rowitem">
|
||||||
<h1>{{lang "convos_head"}}</h1>
|
<h1>{{lang "convos_head"}}</h1>
|
||||||
<h2><a href="/user/convos/create/">Create Convo</a></h2>
|
{{if not .CurrentUser.IsBanned}}<h2><a href="/user/convos/create/">Create Convo</a></h2>{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="colstack_item">
|
<div class="colstack_item">
|
||||||
|
|
Loading…
Reference in New Issue