diff --git a/common/report_store.go b/common/report_store.go index 096b7656..015b6d1d 100644 --- a/common/report_store.go +++ b/common/report_store.go @@ -17,7 +17,7 @@ var ErrAlreadyReported = errors.New("This item has already been reported") // The report system mostly wraps around the topic system for simplicty type ReportStore interface { - Create(title, content string, user *User, itemType string, itemID int) (int, error) + Create(title, content string, u *User, itemType string, itemID int) (int, error) } type DefaultReportStore struct { diff --git a/common/topic_store.go b/common/topic_store.go index 410584da..e2a77ce6 100644 --- a/common/topic_store.go +++ b/common/topic_store.go @@ -240,7 +240,7 @@ func (s *DefaultTopicStore) Create(fid int, name, content string, uid int, ip st return 0, err } tid = int(lastID) - TopicListThaw.Thaw() + //TopicListThaw.Thaw() // redundant return tid, Forums.AddTopic(tid, uid, fid) } diff --git a/public/global.js b/public/global.js index f502f7a5..90da654a 100644 --- a/public/global.js +++ b/public/global.js @@ -665,6 +665,8 @@ function mainInit(){ history.pushState(obj,obj.Title,obj.Url); rebuildPaginator(d.LastPage); rebindPaginator(); + $(".link_select .link_option .link_recent").attr("href",url+q); + $(".link_select .link_option .link_most_viewed").attr("href",url+q); }).catch(e => { log("Unable to get script "+url+q+"&js=1",e); console.trace(); diff --git a/routes/panel/common.go b/routes/panel/common.go index 09ff9110..a57296a1 100644 --- a/routes/panel/common.go +++ b/routes/panel/common.go @@ -4,7 +4,7 @@ import ( "net/http" c "github.com/Azareal/Gosora/common" - "github.com/Azareal/Gosora/common/phrases" + p "github.com/Azareal/Gosora/common/phrases" ) // A blank list to fill out that parameter in Page for routes which don't use it @@ -43,12 +43,12 @@ func renderTemplate(tmplName string, w http.ResponseWriter, r *http.Request, h * return nil } -func buildBasePage(w http.ResponseWriter, r *http.Request, user *c.User, titlePhrase, zone string) (*c.BasePanelPage, c.RouteError) { - header, stats, ferr := c.PanelUserCheck(w, r, user) +func buildBasePage(w http.ResponseWriter, r *http.Request, u *c.User, titlePhrase, zone string) (*c.BasePanelPage, c.RouteError) { + h, stats, ferr := c.PanelUserCheck(w, r, u) if ferr != nil { return nil, ferr } - header.Title = phrases.GetTitlePhrase("panel_" + titlePhrase) + h.Title = p.GetTitlePhrase("panel_" + titlePhrase) - return &c.BasePanelPage{header, stats, zone, c.ReportForumID}, nil + return &c.BasePanelPage{h, stats, zone, c.ReportForumID}, nil } diff --git a/routes/poll.go b/routes/poll.go index 1950c5ba..b9ce3a90 100644 --- a/routes/poll.go +++ b/routes/poll.go @@ -10,7 +10,7 @@ import ( qgen "github.com/Azareal/Gosora/query_gen" ) -func PollVote(w http.ResponseWriter, r *http.Request, user *c.User, sPollID string) c.RouteError { +func PollVote(w http.ResponseWriter, r *http.Request, u *c.User, sPollID string) c.RouteError { pollID, err := strconv.Atoi(sPollID) if err != nil { return c.PreError("The provided PollID is not a valid number.", w, r) @@ -44,19 +44,19 @@ func PollVote(w http.ResponseWriter, r *http.Request, user *c.User, sPollID stri } // TODO: Add hooks to make use of headerLite - _, ferr := c.SimpleForumUserCheck(w, r, user, topic.ParentID) + _, ferr := c.SimpleForumUserCheck(w, r, u, topic.ParentID) if ferr != nil { return ferr } - if !user.Perms.ViewTopic { - return c.NoPermissions(w, r, user) + if !u.Perms.ViewTopic { + return c.NoPermissions(w, r, u) } - optionIndex, err := strconv.Atoi(r.PostFormValue("poll_option_input")) + optIndex, err := strconv.Atoi(r.PostFormValue("poll_option_input")) if err != nil { - return c.LocalError("Malformed input", w, r, user) + return c.LocalError("Malformed input", w, r, u) } - err = poll.CastVote(optionIndex, user.ID, user.GetIP()) + err = poll.CastVote(optIndex, u.ID, u.GetIP()) if err != nil { return c.InternalError(err, w, r) } @@ -65,7 +65,7 @@ func PollVote(w http.ResponseWriter, r *http.Request, user *c.User, sPollID stri return nil } -func PollResults(w http.ResponseWriter, r *http.Request, user *c.User, sPollID string) c.RouteError { +func PollResults(w http.ResponseWriter, r *http.Request, u *c.User, sPollID string) c.RouteError { //log.Print("in PollResults") pollID, err := strconv.Atoi(sPollID) if err != nil { @@ -85,24 +85,23 @@ func PollResults(w http.ResponseWriter, r *http.Request, user *c.User, sPollID s } defer rows.Close() - optionList := "" + optList := "" var votes int for rows.Next() { err := rows.Scan(&votes) if err != nil { return c.InternalError(err, w, r) } - optionList += strconv.Itoa(votes) + "," + optList += strconv.Itoa(votes) + "," } - err = rows.Err() - if err != nil { + if err = rows.Err(); err != nil { return c.InternalError(err, w, r) } // TODO: Implement a version of this which doesn't rely so much on sequential order - if len(optionList) > 0 { - optionList = optionList[:len(optionList)-1] + if len(optList) > 0 { + optList = optList[:len(optList)-1] } - w.Write([]byte("[" + optionList + "]")) + w.Write([]byte("[" + optList + "]")) return nil }