Fixed a bug where group permissions didn't update until Gosora was restarted.

The profile titles can now be localised.
The profile owner tag can now be localised.

Added some changes I forgot to push in the previous commit.
This commit is contained in:
Azareal 2018-10-14 16:09:25 +10:00
parent aabfbe3622
commit 34b8d8dc3c
4 changed files with 24 additions and 44 deletions

View File

@ -151,23 +151,6 @@ func panelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (header
stats.Themes = len(Themes) stats.Themes = len(Themes)
stats.Reports = 0 // TODO: Do the report count. Only show open threads? stats.Reports = 0 // TODO: Do the report count. Only show open threads?
// TODO: Remove this as it might be counter-productive
/*pusher, ok := w.(http.Pusher)
if ok {
pusher.Push("/static/"+theme.Name+"/main.css", nil)
pusher.Push("/static/"+theme.Name+"/panel.css", nil)
pusher.Push("/static/global.js", nil)
pusher.Push("/static/jquery-3.1.1.min.js", nil)
// TODO: Test these
for _, sheet := range header.Stylesheets {
pusher.Push("/static/"+sheet, nil)
}
for _, script := range header.Scripts {
pusher.Push("/static/"+script, nil)
}
// TODO: Push avatars?
}*/
return header, stats, nil return header, stats, nil
} }
@ -252,12 +235,13 @@ func userCheck(w http.ResponseWriter, r *http.Request, user *User) (header *Head
} }
func preRoute(w http.ResponseWriter, r *http.Request) (User, bool) { func preRoute(w http.ResponseWriter, r *http.Request) (User, bool) {
user, halt := Auth.SessionCheck(w, r) userptr, halt := Auth.SessionCheck(w, r)
if halt { if halt {
return *user, false return *userptr, false
} }
var usercpy *User = BlankUser() var usercpy *User = BlankUser()
*usercpy = *user *usercpy = *userptr
usercpy.InitPerms()
// TODO: WIP. Refactor this to eliminate the unnecessary query // TODO: WIP. Refactor this to eliminate the unnecessary query
// TODO: Better take proxies into consideration // TODO: Better take proxies into consideration
@ -284,7 +268,7 @@ func preRoute(w http.ResponseWriter, r *http.Request) (User, bool) {
w.Header().Set("Content-Security-Policy", "upgrade-insecure-requests") w.Header().Set("Content-Security-Policy", "upgrade-insecure-requests")
} }
if user == &GuestUser { if userptr == &GuestUser {
usercpy.LastIP = host usercpy.LastIP = host
return *usercpy, true return *usercpy, true
} }

View File

@ -125,6 +125,7 @@
"login_mfa_verify":"2FA Verify", "login_mfa_verify":"2FA Verify",
"register":"Registration", "register":"Registration",
"ip_search":"IP Search", "ip_search":"IP Search",
"profile": "%s's Profile",
"account":"My Account", "account":"My Account",
"account_password":"Edit Password", "account_password":"Edit Password",
"account_mfa":"Manage 2FA", "account_mfa":"Manage 2FA",
@ -626,6 +627,7 @@
"profile_comments_report_aria":"Report Item", "profile_comments_report_aria":"Report Item",
"profile_comments_form_content":"Insert comment here", "profile_comments_form_content":"Insert comment here",
"profile_comments_form_button":"Create Reply", "profile_comments_form_button":"Create Reply",
"profile_owner_tag":"Profile Owner",
"ip_search_head":"IP Search", "ip_search_head":"IP Search",
"ip_search_search_button":"Search", "ip_search_search_button":"Search",

View File

@ -66,9 +66,9 @@ func ViewProfile(w http.ResponseWriter, r *http.Request, user common.User) commo
} else if err != nil { } else if err != nil {
return common.InternalError(err, w, r) return common.InternalError(err, w, r)
} }
puser.InitPerms()
} }
// TODO: Add a phrase for this title header.Title = common.GetTitlePhrasef("profile", puser.Name)
header.Title = puser.Name + "'s Profile"
header.Path = common.BuildProfileURL(common.NameToSlug(puser.Name), puser.ID) header.Path = common.BuildProfileURL(common.NameToSlug(puser.Name), puser.ID)
// Get the replies.. // Get the replies..
@ -100,7 +100,7 @@ func ViewProfile(w http.ResponseWriter, r *http.Request, user common.User) commo
if group.Tag != "" { if group.Tag != "" {
replyTag = group.Tag replyTag = group.Tag
} else if puser.ID == replyCreatedBy { } else if puser.ID == replyCreatedBy {
replyTag = "Profile Owner" replyTag = common.GetTmplPhrase("profile_owner_tag")
} else { } else {
replyTag = "" replyTag = ""
} }

View File

@ -50,7 +50,7 @@ li a {
color: rgb(221,221,221); color: rgb(221,221,221);
padding-top: 31px; padding-top: 31px;
} }
.menu_topics a { .menu_left.menu_active a {
border-bottom: 2px solid #777777; border-bottom: 2px solid #777777;
padding-bottom: 21px; padding-bottom: 21px;
color: #dddddd; color: #dddddd;
@ -343,7 +343,6 @@ h2 {
} }
.topic_list_title_block .optbox { .topic_list_title_block .optbox {
display: flex; display: flex;
/*margin-left: auto;*/
font-size: 17px; font-size: 17px;
margin-top: 3.5px; margin-top: 3.5px;
margin-right: 16px; margin-right: 16px;
@ -467,9 +466,9 @@ h2 {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.topic_inner_left br, .topic_right_inside br, .topic_inner_right { .topic_inner_left br,
display: none; .topic_right_inside br,
} .topic_inner_right,
.topic_list:not(.topic_list_mostviewed) .topic_middle .viewCount, .topic_list:not(.topic_list_mostviewed) .topic_middle .viewCount,
.topic_list_mostviewed .topic_middle .likeCount { .topic_list_mostviewed .topic_middle .likeCount {
display: none; display: none;
@ -517,7 +516,6 @@ input {
font-size: 16px; font-size: 16px;
} }
input, select { input, select {
/*margin-left: 4px;*/
margin-left: 3px; margin-left: 3px;
margin-bottom: 4px; margin-bottom: 4px;
} }
@ -642,10 +640,8 @@ button, .formbutton, .panel_right_button:not(.has_inner_button) {
background-color: #444444; background-color: #444444;
border-radius: 3px; border-radius: 3px;
width: 150px; width: 150px;
display: flex;
flex-direction: column;
} }
.user_meta { .userinfo, .user_meta {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
@ -706,12 +702,11 @@ button, .formbutton, .panel_right_button:not(.has_inner_button) {
color: #dddddd; color: #dddddd;
white-space: nowrap; white-space: nowrap;
} }
.post_item .action_button_left { .post_item .action_button_left, .post_item .action_button_right {
display: flex; display: flex;
} }
.post_item .action_button_right { .post_item .action_button_right {
margin-left: auto; margin-left: auto;
display: flex;
} }
.post_item .controls:not(.has_likes) .like_count { .post_item .controls:not(.has_likes) .like_count {
display: none; display: none;
@ -799,7 +794,7 @@ input[type=checkbox]:checked + label .sel {
content: "{{index .Phrases "topic.report_button_text"}}"; content: "{{index .Phrases "topic.report_button_text"}}";
} }
.like_count:after { .like_count:after {
content: " likes"; content: "{{index .Phrases "topic.like_count_suffix"}}";
} }
.topic_reply_container { .topic_reply_container {
@ -820,16 +815,16 @@ input[type=checkbox]:checked + label .sel {
margin-bottom: 10px; margin-bottom: 10px;
padding: 16px; padding: 16px;
} }
.rowlist.bgavatars .bgsub { .rowlist.bgavatars .bgsub, .rowlist.bgavatars .rowTitle {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
}
.rowlist.bgavatars .bgsub {
border-radius: 32px; border-radius: 32px;
height: 64px; height: 64px;
width: 64px; width: 64px;
} }
.rowlist.bgavatars .rowTitle { .rowlist.bgavatars .rowTitle {
margin-left: auto;
margin-right: auto;
font-size: 18px; font-size: 18px;
margin-top: 4px; margin-top: 4px;
} }
@ -860,7 +855,7 @@ input[type=checkbox]:checked + label .sel {
background-color: #444444; background-color: #444444;
} }
.level_complete, .level_future, .level_inprogress { .level_complete, .level_future, .level_inprogress, .progressWrap {
display: flex; display: flex;
} }
.level_complete { .level_complete {
@ -872,7 +867,6 @@ input[type=checkbox]:checked + label .sel {
width: 100%; width: 100%;
} }
.progressWrap { .progressWrap {
display: flex;
margin-left: auto; margin-left: auto;
} }
/* CSS behaves in stupid ways, so we need to be very specific about this */ /* CSS behaves in stupid ways, so we need to be very specific about this */
@ -1020,7 +1014,7 @@ input[type=checkbox]:checked + label .sel {
color: rgb(226,226,226); color: rgb(226,226,226);
padding-top: 12px; padding-top: 12px;
} }
.menu_topics a { .menu_left.menu_active a {
color: #cfcfcf; color: #cfcfcf;
} }
} }
@ -1043,7 +1037,7 @@ input[type=checkbox]:checked + label .sel {
font-size: 16px; font-size: 16px;
color: #cfcfcf; color: #cfcfcf;
} }
.menu_topics a { .menu_left.menu_active a {
color: #dddddd; color: #dddddd;
} }
} }
@ -1065,7 +1059,7 @@ input[type=checkbox]:checked + label .sel {
padding-top: 14px; padding-top: 14px;
display: inline-block; display: inline-block;
} }
.menu_topics a { .menu_left.menu_active a {
padding-bottom: 15px; padding-bottom: 15px;
border: none; border: none;
} }