From 948a06df4e057c1611d046ac448b1cbf3a872f3c Mon Sep 17 00:00:00 2001 From: flashwave Date: Wed, 7 Dec 2016 15:32:08 +0100 Subject: [PATCH] fix profile detail permissions --- resources/views/yuuno/user/profile.twig | 131 ++++++++++++------------ 1 file changed, 67 insertions(+), 64 deletions(-) diff --git a/resources/views/yuuno/user/profile.twig b/resources/views/yuuno/user/profile.twig index d73ca14..5f9f8f0 100644 --- a/resources/views/yuuno/user/profile.twig +++ b/resources/views/yuuno/user/profile.twig @@ -5,67 +5,69 @@ {% set title = profileHidden ? 'User not found!' : 'Profile of ' ~ profile.username %} {% set youtubeIsChannelId = profile.youtube|slice(0, 2) == 'UC' and profile.youtube|length == 24 %} -{% set fields = { - "website": { - "title": "Website", - "value": profile.website, - "link": "%s", - }, - "twitter": { - "title": "Twitter", - "value": profile.twitter, - "link": "https://twitter.com/%s", - "disp": "@%s", - }, - "github": { - "title": "GitHub", - "value": profile.github, - "link": "https://github.com/%s", - }, - "skype": { - "title": "Skype", - "value": profile.skype, - "link": "skype:%s?userinfo", - }, - "discord": { - "title": "Discord", - "value": profile.discord, - }, - "youtube": { - "title": "YouTube", - "value": profile.youtube, - "link": "https://youtube.com/" ~ (youtubeIsChannelId ? 'channel/' : '') ~ "%s", - "disp": youtubeIsChannelId ? profile.username ~ "'s channel" : "%s", - }, - "steam": { - "title": "Steam", - "value": profile.steam, - "link": "https://steamcommunity.com/id/%s", - }, - "osu": { - "title": "osu!", - "value": profile.osu, - "link": "https://osu.ppy.sh/u/%s", - }, - "lastfm": { - "title": "Last.fm", - "value": profile.lastfm, - "link": "http://last.fm/user/%s", - }, - "email": { - "title": "E-mail address", - "value": user.perms.viewUserDetails ? profile.email : null, - "link": "mailto:%s" - }, - "registerip": { - "title": "Register IP", - "value": user.perms.viewUserDetails ? profile.registerIp : null, - }, - "lastip": { - "title": "Last IP", - "value": user.perms.viewUserDetails ? profile.lastIp : null, - }, -} %} +{% if user.perms.viewUserLinks or user.perms.viewUserDetails %} + {% set fields = { + "website": { + "title": "Website", + "value": profile.website, + "link": "%s", + }, + "twitter": { + "title": "Twitter", + "value": profile.twitter, + "link": "https://twitter.com/%s", + "disp": "@%s", + }, + "github": { + "title": "GitHub", + "value": profile.github, + "link": "https://github.com/%s", + }, + "skype": { + "title": "Skype", + "value": profile.skype, + "link": "skype:%s?userinfo", + }, + "discord": { + "title": "Discord", + "value": profile.discord, + }, + "youtube": { + "title": "YouTube", + "value": profile.youtube, + "link": "https://youtube.com/" ~ (youtubeIsChannelId ? 'channel/' : '') ~ "%s", + "disp": youtubeIsChannelId ? profile.username ~ "'s channel" : "%s", + }, + "steam": { + "title": "Steam", + "value": profile.steam, + "link": "https://steamcommunity.com/id/%s", + }, + "osu": { + "title": "osu!", + "value": profile.osu, + "link": "https://osu.ppy.sh/u/%s", + }, + "lastfm": { + "title": "Last.fm", + "value": profile.lastfm, + "link": "http://last.fm/user/%s", + }, + "email": { + "title": "E-mail address", + "value": user.perms.viewUserDetails ? profile.email : null, + "link": "mailto:%s" + }, + "registerip": { + "title": "Register IP", + "value": user.perms.viewUserDetails ? profile.registerIp : null, + }, + "lastip": { + "title": "Last IP", + "value": user.perms.viewUserDetails ? profile.lastIp : null, + }, + } %} +{% endif %} {% block js %} {% if not profileHidden %} @@ -300,8 +302,7 @@
- {% if user.isActive %} - {# if user.perms.viewUserLinks or user.perms.viewUserDetails #} + {% if user.perms.viewUserLinks or user.perms.viewUserDetails %} {% for id, data in fields %} {% if data.value != null %} @@ -320,8 +321,10 @@ {% endif %} {% endfor %}
+ {% elseif user.id == 0 %} +
Log in to view the full profile!
{% else %} - Log in to view the full profile! +
You aren't allowed to view profile details!
{% endif %} Account Standing {% if not profile.activated %}