Fix a bug where the convos page would 404.

Friendly message when there are no convos.
Fix the convo input css.
Hide elapsed on mobile for Nox.

Added convos_none phrase.
This commit is contained in:
Azareal 2019-10-08 07:22:33 +10:00
parent 3798838ece
commit 84cd10a8c9
6 changed files with 61 additions and 38 deletions

View File

@ -1,6 +1,6 @@
package main package main
import "github.com/Azareal/Gosora/query_gen" import qgen "github.com/Azareal/Gosora/query_gen"
var mysqlPre = "utf8mb4" var mysqlPre = "utf8mb4"
var mysqlCol = "utf8mb4_general_ci" var mysqlCol = "utf8mb4_general_ci"
@ -52,8 +52,8 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"temp_group", "int", 0, false, false, "0"}, // For temporary groups, set this to zero when a temporary group isn't in effect tC{"temp_group", "int", 0, false, false, "0"}, // For temporary groups, set this to zero when a temporary group isn't in effect
}, },
[]tblKey{ []tblKey{
tblKey{"uid", "primary","",false}, tblKey{"uid", "primary", "", false},
tblKey{"name", "unique","",false}, tblKey{"name", "unique", "", false},
}, },
) )
@ -71,7 +71,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"tag", "varchar", 50, false, false, "''"}, tC{"tag", "varchar", 50, false, false, "''"},
}, },
[]tblKey{ []tblKey{
tblKey{"gid", "primary","",false}, tblKey{"gid", "primary", "", false},
}, },
) )
@ -80,7 +80,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"pid", "int", 0, false, true, ""}, tC{"pid", "int", 0, false, true, ""},
tC{"from_gid", "int", 0, false, false, ""}, tC{"from_gid", "int", 0, false, false, ""},
tC{"to_gid", "int", 0, false, false, ""}, tC{"to_gid", "int", 0, false, false, ""},
tC{"two_way", "boolean",0,false,false,"0"}, // If a user no longer meets the requirements for this promotion then they will be demoted if this flag is set tC{"two_way", "boolean", 0, false, false, "0"}, // If a user no longer meets the requirements for this promotion then they will be demoted if this flag is set
// Requirements // Requirements
tC{"level", "int", 0, false, false, ""}, tC{"level", "int", 0, false, false, ""},
@ -88,7 +88,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"minTime", "int", 0, false, false, ""}, // How long someone needs to have been in their current group before being promoted tC{"minTime", "int", 0, false, false, ""}, // How long someone needs to have been in their current group before being promoted
}, },
[]tblKey{ []tblKey{
tblKey{"pid", "primary","",false}, tblKey{"pid", "primary", "", false},
}, },
) )
@ -107,7 +107,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"createdAt", "createdAt", 0, false, false, ""}, tC{"createdAt", "createdAt", 0, false, false, ""},
}, },
[]tblKey{ []tblKey{
tblKey{"uid", "primary","",false}, tblKey{"uid", "primary", "", false},
}, },
) )
@ -152,7 +152,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"temporary", "boolean", 0, false, false, ""}, // special case for permanent bans to do the necessary bookkeeping, might be removed in the future tC{"temporary", "boolean", 0, false, false, ""}, // special case for permanent bans to do the necessary bookkeeping, might be removed in the future
}, },
[]tblKey{ []tblKey{
tblKey{"uid", "primary","",false}, tblKey{"uid", "primary", "", false},
}, },
) )
@ -162,7 +162,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"uid", "int", 0, false, false, ""}, // TODO: Make this a foreign key tC{"uid", "int", 0, false, false, ""}, // TODO: Make this a foreign key
}, },
[]tblKey{ []tblKey{
tblKey{"uid", "primary","",false}, tblKey{"uid", "primary", "", false},
}, },
) )
@ -216,7 +216,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"lastReplyerID", "int", 0, false, false, "0"}, tC{"lastReplyerID", "int", 0, false, false, "0"},
}, },
[]tblKey{ []tblKey{
tblKey{"fid", "primary","",false}, tblKey{"fid", "primary", "", false},
}, },
) )
@ -229,7 +229,7 @@ func createTables(adapter qgen.Adapter) (err error) {
}, },
[]tblKey{ []tblKey{
// TODO: Test to see that the compound primary key works // TODO: Test to see that the compound primary key works
tblKey{"fid,gid", "primary","",false}, tblKey{"fid,gid", "primary", "", false},
}, },
) )
@ -265,8 +265,8 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"data", "varchar", 200, false, false, "''"}, tC{"data", "varchar", 200, false, false, "''"},
}, },
[]tblKey{ []tblKey{
tblKey{"tid", "primary","",false}, tblKey{"tid", "primary", "", false},
tblKey{"content", "fulltext","",false}, tblKey{"content", "fulltext", "", false},
}, },
) )
@ -289,8 +289,8 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"poll", "int", 0, false, false, "0"}, tC{"poll", "int", 0, false, false, "0"},
}, },
[]tblKey{ []tblKey{
tblKey{"rid", "primary","",false}, tblKey{"rid", "primary", "", false},
tblKey{"content", "fulltext","",false}, tblKey{"content", "fulltext", "", false},
}, },
) )
@ -306,7 +306,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"extra", "varchar", 200, false, false, ""}, tC{"extra", "varchar", 200, false, false, ""},
}, },
[]tblKey{ []tblKey{
tblKey{"attachID", "primary","",false}, tblKey{"attachID", "primary", "", false},
}, },
) )
@ -320,7 +320,7 @@ func createTables(adapter qgen.Adapter) (err error) {
// TODO: Add a createdBy column? // TODO: Add a createdBy column?
}, },
[]tblKey{ []tblKey{
tblKey{"reviseID", "primary","",false}, tblKey{"reviseID", "primary", "", false},
}, },
) )
@ -334,7 +334,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"votes", "int", 0, false, false, "0"}, tC{"votes", "int", 0, false, false, "0"},
}, },
[]tblKey{ []tblKey{
tblKey{"pollID", "primary","",false}, tblKey{"pollID", "primary", "", false},
}, },
) )
@ -369,7 +369,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"ipaddress", "varchar", 200, false, false, "0.0.0.0.0"}, tC{"ipaddress", "varchar", 200, false, false, "0.0.0.0.0"},
}, },
[]tblKey{ []tblKey{
tblKey{"rid", "primary","",false}, tblKey{"rid", "primary", "", false},
}, },
) )
@ -394,7 +394,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"lastReplyBy", "int", 0, false, false, ""}, tC{"lastReplyBy", "int", 0, false, false, ""},
}, },
[]tblKey{ []tblKey{
tblKey{"cid", "primary","",false}, tblKey{"cid", "primary", "", false},
}, },
) )
@ -407,7 +407,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"post", "varchar", 50, false, false, "''"}, tC{"post", "varchar", 50, false, false, "''"},
}, },
[]tblKey{ []tblKey{
tblKey{"pid", "primary","",false}, tblKey{"pid", "primary", "", false},
}, },
) )
@ -418,13 +418,22 @@ func createTables(adapter qgen.Adapter) (err error) {
}, nil, }, nil,
) )
/*
createTable("users_blocks", "", "",
[]tC{
tC{"blocker", "int", 0, false, false, ""},
tC{"uid", "int", 0, false, false, ""},
}, nil,
)
*/
createTable("activity_stream_matches", "", "", createTable("activity_stream_matches", "", "",
[]tC{ []tC{
tC{"watcher", "int", 0, false, false, ""}, // TODO: Make this a foreign key tC{"watcher", "int", 0, false, false, ""}, // TODO: Make this a foreign key
tC{"asid", "int", 0, false, false, ""}, // TODO: Make this a foreign key tC{"asid", "int", 0, false, false, ""}, // TODO: Make this a foreign key
}, },
[]tblKey{ []tblKey{
tblKey{"asid,asid","foreign","activity_stream",true}, tblKey{"asid,asid", "foreign", "activity_stream", true},
}, },
) )
@ -439,7 +448,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"createdAt", "createdAt", 0, false, false, ""}, tC{"createdAt", "createdAt", 0, false, false, ""},
}, },
[]tblKey{ []tblKey{
tblKey{"asid", "primary","",false}, tblKey{"asid", "primary", "", false},
}, },
) )
@ -461,7 +470,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"constraints", "varchar", 200, false, false, "''"}, tC{"constraints", "varchar", 200, false, false, "''"},
}, },
[]tblKey{ []tblKey{
tblKey{"name", "unique","",false}, tblKey{"name", "unique", "", false},
}, },
) )
@ -472,7 +481,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"replacement", "varchar", 200, false, false, ""}, tC{"replacement", "varchar", 200, false, false, ""},
}, },
[]tblKey{ []tblKey{
tblKey{"wfid", "primary","",false}, tblKey{"wfid", "primary", "", false},
}, },
) )
@ -483,7 +492,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"installed", "boolean", 0, false, false, "0"}, tC{"installed", "boolean", 0, false, false, "0"},
}, },
[]tblKey{ []tblKey{
tblKey{"uname", "unique","",false}, tblKey{"uname", "unique", "", false},
}, },
) )
@ -494,7 +503,7 @@ func createTables(adapter qgen.Adapter) (err error) {
//tC{"profileUserVars", "text", 0, false, false, "''"}, //tC{"profileUserVars", "text", 0, false, false, "''"},
}, },
[]tblKey{ []tblKey{
tblKey{"uname", "unique","",false}, tblKey{"uname", "unique", "", false},
}, },
) )
@ -509,7 +518,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"data", "text", 0, false, false, "''"}, tC{"data", "text", 0, false, false, "''"},
}, },
[]tblKey{ []tblKey{
tblKey{"wid", "primary","",false}, tblKey{"wid", "primary", "", false},
}, },
) )
@ -518,7 +527,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"mid", "int", 0, false, true, ""}, tC{"mid", "int", 0, false, true, ""},
}, },
[]tblKey{ []tblKey{
tblKey{"mid", "primary","",false}, tblKey{"mid", "primary", "", false},
}, },
) )
@ -542,7 +551,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"adminOnly", "boolean", 0, false, false, "0"}, tC{"adminOnly", "boolean", 0, false, false, "0"},
}, },
[]tblKey{ []tblKey{
tblKey{"miid", "primary","",false}, tblKey{"miid", "primary", "", false},
}, },
) )
@ -558,7 +567,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"menuID", "int", 0, false, false, "-1"}, // simple sidebar menu tC{"menuID", "int", 0, false, false, "-1"}, // simple sidebar menu
}, },
[]tblKey{ []tblKey{
tblKey{"pid", "primary","",false}, tblKey{"pid", "primary", "", false},
}, },
) )
@ -573,7 +582,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"doneAt", "createdAt", 0, false, false, ""}, tC{"doneAt", "createdAt", 0, false, false, ""},
}, },
[]tblKey{ []tblKey{
tblKey{"rlid", "primary","",false}, tblKey{"rlid", "primary", "", false},
}, },
) )
@ -586,7 +595,7 @@ func createTables(adapter qgen.Adapter) (err error) {
tC{"doneAt", "createdAt", 0, false, false, ""}, tC{"doneAt", "createdAt", 0, false, false, ""},
}, },
[]tblKey{ []tblKey{
tblKey{"lid", "primary","",false}, tblKey{"lid", "primary", "", false},
}, },
) )

View File

@ -537,6 +537,7 @@
"convos_head":"Conversations", "convos_head":"Conversations",
"convos_create":"Create Convo", "convos_create":"Create Convo",
"convos_none":"You don't have any conversations yet.",
"convo_head":"Conversation", "convo_head":"Conversation",
"convo_users":"Participants", "convo_users":"Participants",
"create_convo_head":"Create Conversation", "create_convo_head":"Create Conversation",

View File

@ -25,9 +25,7 @@ func Convos(w http.ResponseWriter, r *http.Request, user c.User, h *c.Header) c.
convos, err := c.Convos.GetUserExtra(user.ID, offset) convos, err := c.Convos.GetUserExtra(user.ID, offset)
//log.Printf("convos: %+v\n", convos) //log.Printf("convos: %+v\n", convos)
if err == sql.ErrNoRows { if err != sql.ErrNoRows && err != nil {
return c.NotFound(w, r, h)
} else if err != nil {
return c.InternalError(err, w, r) return c.InternalError(err, w, r)
} }

View File

@ -31,6 +31,8 @@
</span> </span>
<span title="{{abstime .LastReplyAt}}" class="to_right">{{reltime .LastReplyAt}}</span> <span title="{{abstime .LastReplyAt}}" class="to_right">{{reltime .LastReplyAt}}</span>
<div style="clear:both;"></div> <div style="clear:both;"></div>
</div>{{end}} </div>{{else}}
<div class="rowitem">{{lang "convos_none"}}</div>
{{end}}
</div> </div>
{{template "paginator.html" . }} {{template "paginator.html" . }}

View File

@ -55,3 +55,13 @@
.content_column { .content_column {
margin-top: 5px; margin-top: 5px;
} }
.topic_reply_form {
margin-top: 8px;
padding: 12px;
}
.input_content {
width: 100%;
height: 100px;
resize: vertical;
}

View File

@ -1415,6 +1415,9 @@ input[type=checkbox]:checked + label .sel {
font-size: 17px; font-size: 17px;
line-height: 28px; line-height: 28px;
} }
.elapsed {
display: none;
}
} }
@media(min-width: 751px) { @media(min-width: 751px) {