fix profile detail permissions

This commit is contained in:
flash 2016-12-07 15:32:08 +01:00
parent b3fac428e9
commit 948a06df4e

View file

@ -5,67 +5,69 @@
{% set title = profileHidden ? 'User not found!' : 'Profile of ' ~ profile.username %} {% set title = profileHidden ? 'User not found!' : 'Profile of ' ~ profile.username %}
{% set youtubeIsChannelId = profile.youtube|slice(0, 2) == 'UC' and profile.youtube|length == 24 %} {% set youtubeIsChannelId = profile.youtube|slice(0, 2) == 'UC' and profile.youtube|length == 24 %}
{% set fields = { {% if user.perms.viewUserLinks or user.perms.viewUserDetails %}
"website": { {% set fields = {
"title": "Website", "website": {
"value": profile.website, "title": "Website",
"link": "%s", "value": profile.website,
}, "link": "%s",
"twitter": { },
"title": "Twitter", "twitter": {
"value": profile.twitter, "title": "Twitter",
"link": "https://twitter.com/%s", "value": profile.twitter,
"disp": "@%s", "link": "https://twitter.com/%s",
}, "disp": "@%s",
"github": { },
"title": "GitHub", "github": {
"value": profile.github, "title": "GitHub",
"link": "https://github.com/%s", "value": profile.github,
}, "link": "https://github.com/%s",
"skype": { },
"title": "Skype", "skype": {
"value": profile.skype, "title": "Skype",
"link": "skype:%s?userinfo", "value": profile.skype,
}, "link": "skype:%s?userinfo",
"discord": { },
"title": "Discord", "discord": {
"value": profile.discord, "title": "Discord",
}, "value": profile.discord,
"youtube": { },
"title": "YouTube", "youtube": {
"value": profile.youtube, "title": "YouTube",
"link": "https://youtube.com/" ~ (youtubeIsChannelId ? 'channel/' : '') ~ "%s", "value": profile.youtube,
"disp": youtubeIsChannelId ? profile.username ~ "'s channel" : "%s", "link": "https://youtube.com/" ~ (youtubeIsChannelId ? 'channel/' : '') ~ "%s",
}, "disp": youtubeIsChannelId ? profile.username ~ "'s channel" : "%s",
"steam": { },
"title": "Steam", "steam": {
"value": profile.steam, "title": "Steam",
"link": "https://steamcommunity.com/id/%s", "value": profile.steam,
}, "link": "https://steamcommunity.com/id/%s",
"osu": { },
"title": "osu!", "osu": {
"value": profile.osu, "title": "osu!",
"link": "https://osu.ppy.sh/u/%s", "value": profile.osu,
}, "link": "https://osu.ppy.sh/u/%s",
"lastfm": { },
"title": "Last.fm", "lastfm": {
"value": profile.lastfm, "title": "Last.fm",
"link": "http://last.fm/user/%s", "value": profile.lastfm,
}, "link": "http://last.fm/user/%s",
"email": { },
"title": "E-mail address", "email": {
"value": user.perms.viewUserDetails ? profile.email : null, "title": "E-mail address",
"link": "mailto:%s" "value": user.perms.viewUserDetails ? profile.email : null,
}, "link": "mailto:%s"
"registerip": { },
"title": "Register IP", "registerip": {
"value": user.perms.viewUserDetails ? profile.registerIp : null, "title": "Register IP",
}, "value": user.perms.viewUserDetails ? profile.registerIp : null,
"lastip": { },
"title": "Last IP", "lastip": {
"value": user.perms.viewUserDetails ? profile.lastIp : null, "title": "Last IP",
}, "value": user.perms.viewUserDetails ? profile.lastIp : null,
} %} },
} %}
{% endif %}
{% block js %} {% block js %}
{% if not profileHidden %} {% if not profileHidden %}
@ -300,8 +302,7 @@
</tr> </tr>
</table> </table>
<hr> <hr>
{% if user.isActive %} {% if user.perms.viewUserLinks or user.perms.viewUserDetails %}
{# if user.perms.viewUserLinks or user.perms.viewUserDetails #}
<table style="width: 100%;"> <table style="width: 100%;">
{% for id, data in fields %} {% for id, data in fields %}
{% if data.value != null %} {% if data.value != null %}
@ -320,8 +321,10 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</table> </table>
{% elseif user.id == 0 %}
<div><b>Log in to view the full profile!</b></div>
{% else %} {% else %}
<b>Log in to view the full profile!</b> <div><b>You aren't allowed to view profile details!</b></div>
{% endif %} {% endif %}
<b>Account Standing</b> <b>Account Standing</b>
{% if not profile.activated %} {% if not profile.activated %}