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.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
}
@ -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) {
user, halt := Auth.SessionCheck(w, r)
userptr, halt := Auth.SessionCheck(w, r)
if halt {
return *user, false
return *userptr, false
}
var usercpy *User = BlankUser()
*usercpy = *user
*usercpy = *userptr
usercpy.InitPerms()
// TODO: WIP. Refactor this to eliminate the unnecessary query
// 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")
}
if user == &GuestUser {
if userptr == &GuestUser {
usercpy.LastIP = host
return *usercpy, true
}

View File

@ -125,6 +125,7 @@
"login_mfa_verify":"2FA Verify",
"register":"Registration",
"ip_search":"IP Search",
"profile": "%s's Profile",
"account":"My Account",
"account_password":"Edit Password",
"account_mfa":"Manage 2FA",
@ -626,6 +627,7 @@
"profile_comments_report_aria":"Report Item",
"profile_comments_form_content":"Insert comment here",
"profile_comments_form_button":"Create Reply",
"profile_owner_tag":"Profile Owner",
"ip_search_head":"IP 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 {
return common.InternalError(err, w, r)
}
puser.InitPerms()
}
// TODO: Add a phrase for this title
header.Title = puser.Name + "'s Profile"
header.Title = common.GetTitlePhrasef("profile", puser.Name)
header.Path = common.BuildProfileURL(common.NameToSlug(puser.Name), puser.ID)
// Get the replies..
@ -100,7 +100,7 @@ func ViewProfile(w http.ResponseWriter, r *http.Request, user common.User) commo
if group.Tag != "" {
replyTag = group.Tag
} else if puser.ID == replyCreatedBy {
replyTag = "Profile Owner"
replyTag = common.GetTmplPhrase("profile_owner_tag")
} else {
replyTag = ""
}

View File

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