mirror of
https://github.com/writefreely/writefreely
synced 2024-11-14 05:07:07 +00:00
Merge pull request #479 from writefreely/fix-stats-no-host-log
Fix "Collection.hostName is empty!" log on Stats page
This commit is contained in:
commit
6291f4f155
2 changed files with 5 additions and 3 deletions
|
@ -1021,9 +1021,10 @@ func viewStats(app *App, u *User, w http.ResponseWriter, r *http.Request) error
|
|||
if c.OwnerID != u.ID {
|
||||
return ErrCollectionNotFound
|
||||
}
|
||||
c.hostName = app.cfg.App.Host
|
||||
}
|
||||
|
||||
topPosts, err := app.db.GetTopPosts(u, alias)
|
||||
topPosts, err := app.db.GetTopPosts(u, alias, c.hostName)
|
||||
if err != nil {
|
||||
log.Error("Unable to get top posts: %v", err)
|
||||
return err
|
||||
|
|
|
@ -76,7 +76,7 @@ type writestore interface {
|
|||
GetMeStats(u *User) userMeStats
|
||||
GetTotalCollections() (int64, error)
|
||||
GetTotalPosts() (int64, error)
|
||||
GetTopPosts(u *User, alias string) (*[]PublicPost, error)
|
||||
GetTopPosts(u *User, alias string, hostName string) (*[]PublicPost, error)
|
||||
GetAnonymousPosts(u *User, page int) (*[]PublicPost, error)
|
||||
GetUserPosts(u *User) (*[]PublicPost, error)
|
||||
|
||||
|
@ -1767,7 +1767,7 @@ func (db *datastore) GetTotalPosts() (postCount int64, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (db *datastore) GetTopPosts(u *User, alias string) (*[]PublicPost, error) {
|
||||
func (db *datastore) GetTopPosts(u *User, alias string, hostName string) (*[]PublicPost, error) {
|
||||
params := []interface{}{u.ID}
|
||||
where := ""
|
||||
if alias != "" {
|
||||
|
@ -1802,6 +1802,7 @@ func (db *datastore) GetTopPosts(u *User, alias string) (*[]PublicPost, error) {
|
|||
c.Title = title.String
|
||||
c.Description = description.String
|
||||
c.Views = views.Int64
|
||||
c.hostName = hostName
|
||||
pubPost.Collection = &CollectionObj{Collection: c}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue