diff --git a/controllers/wikiauth.go b/controllers/wikiauth.go index 6547363..30ccf9d 100644 --- a/controllers/wikiauth.go +++ b/controllers/wikiauth.go @@ -28,8 +28,9 @@ func (wikiAuth *WikiAthenticator) Name() string { // Find finds a user that has logged in at least once func (wikiAuth *WikiAthenticator) Find(username string) *auth.User { db := server.Main.DB + fullID := wikiAuth.ID() + ":" + username - rows, err := db.Query("SELECT id,role FROM `user` WHERE id=?", username) + rows, err := db.Query("SELECT id,role FROM `user` WHERE id=?", fullID) if err != nil { log.Println("WikiAthenticator.Find:", err) return nil @@ -45,6 +46,7 @@ func (wikiAuth *WikiAthenticator) Find(username string) *auth.User { role := "member" rows.Scan(&user.ID, &role) user.Data["role"] = role + user.ID = strings.SplitN(user.ID, ":", 2)[1] return user } @@ -79,7 +81,7 @@ func (wikiAuth *WikiAthenticator) Login(username, password string) (*auth.User, return nil, fmt.Errorf("Login failed %v", err) } - return auth.NewUser(wikiAuth, fullID, "member", nil), nil + return auth.NewUser(wikiAuth, username, "member", nil), nil } // If the user was found, read it in diff --git a/formparser/parsers.go b/formparser/parsers.go index b684229..eaee1ea 100644 --- a/formparser/parsers.go +++ b/formparser/parsers.go @@ -3,7 +3,6 @@ package formparser import ( "errors" "fmt" - "log" "time" ) @@ -31,8 +30,6 @@ func Select(value string, target *string, allowedValues []string, optional bool) return nil } - log.Println(value, allowedValues) - for _, allowedValue := range allowedValues { if value == allowedValue { *target = value diff --git a/model/category.go b/model/category.go index 22382c3..5e108a4 100644 --- a/model/category.go +++ b/model/category.go @@ -21,11 +21,11 @@ func (category *PageCategory) URLRoot() string { // a limited selection of categories. I may move it to a configuration // or the database, but for now I think this list is pretty fixed var PageCategories = []PageCategory{ - {"OoC", "OoC", "O", "OoC content is for announcements, scheduling, general information, or anything that is not in-universe"}, - {"Info", "Info", "i", "Information gained during and between RP sessions"}, + //{"OoC", "OoC", "O", "OoC content is for announcements, scheduling, general information, or anything that is not in-universe"}, + {"Info", "Info", "i", "Information relevant to RP that might be something looked for in IRC logs"}, {"News", "News", "N", "News stories that might be pertinent to ongoing plots"}, - {"Item", "Items", "I", "Items relevant to plots, that is more than just a document saved on a character's own omni-tool"}, - {"Document", "Document", "D", "Data files, shadow broker dossiers, and other data that is not inside an item"}, + //{"Item", "Items", "I", "Items relevant to plots, that is more than just a document saved on a character's own omni-tool"}, + {"Document", "Documents", "D", "Data files, shadow broker dossiers, and other data that is not inside an item"}, {"Background", "Background", "B", "Rumors, suspicious persons, or inter-RP occurences that may be noticed"}, {"Story", "Stories", "S", "Background stories and inter-RP character intearactions"}, } diff --git a/model/header.go b/model/header.go index 1832118..28f8806 100644 --- a/model/header.go +++ b/model/header.go @@ -206,6 +206,8 @@ func parseHeader(header *Header, rows *sql.Rows) error { rows.Scan(&header.ID, &header.Name, &header.Author, &header.Category, &fictionalDate, &publishDate, &editDate, &header.Dated, &tagID, &tagType, &tagName) if tagID != "" { header.PrimaryTag = &Tag{tagID, tagType, tagName} + } else { + header.PrimaryTag = nil } header.FictionalDate, err = time.Parse("2006-01-02 15:04:05", fictionalDate) diff --git a/model/tag.go b/model/tag.go index 8b436f8..75f3f48 100644 --- a/model/tag.go +++ b/model/tag.go @@ -16,6 +16,7 @@ var TagTypes = []string{ "Event", "Organization", "Source", + "Series", } // Tag describes a tag diff --git a/tables.sql b/tables.sql index cda98e0..90fe87d 100644 --- a/tables.sql +++ b/tables.sql @@ -7,7 +7,7 @@ CREATE TABLE user ( INDEX(role) ); -INSERT INTO user (id, role) VALUES("test:Test", "restricted") +INSERT INTO user (id, role) VALUES("test:Test", "restricted"); CREATE TABLE page ( `id` CHAR(16) NOT NULL PRIMARY KEY, diff --git a/viewmodel/base.go b/viewmodel/base.go index d26fab2..3e9ff94 100644 --- a/viewmodel/base.go +++ b/viewmodel/base.go @@ -2,7 +2,6 @@ package viewmodel import ( "fmt" - "log" "git.aiterp.net/AiteRP/aitestory/server" "git.aiterp.net/gisle/wrouter/auth" @@ -23,8 +22,6 @@ type Base struct { // InitBase initializes the base of the viewmodel func (base *Base) setupBase(user *auth.User, viewTitle string) { if user != nil { - log.Printf("%+v", user) - base.User.ID = user.FullID() base.User.Name = user.ID base.User.Role = user.Data["role"]