This is an automated email from the ASF dual-hosted git repository. gcruz pushed a commit to branch gc/8446 in repository https://gitbox.apache.org/repos/asf/allura.git
commit 7d897b3b3b8cc921da6cd38175b61fa04bcc6076 Author: Guillermo Cruz <[email protected]> AuthorDate: Mon Jul 18 08:50:54 2022 -0600 [#8446] fixed tooltip loading for profile links, converted new setting to boolean --- Allura/allura/controllers/project.py | 15 +++++---------- Allura/allura/lib/app_globals.py | 2 +- Allura/allura/public/nf/js/allura-base.js | 2 +- Allura/allura/templates/jinja_master/lib.html | 6 +++--- Allura/allura/templates/macro/members.html | 2 +- Allura/allura/templates/members.html | 4 ++-- Allura/allura/templates/repo/merge_requests.html | 4 ++-- 7 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py index 827c58bd9..94b48a17c 100644 --- a/Allura/allura/controllers/project.py +++ b/Allura/allura/controllers/project.py @@ -380,17 +380,12 @@ class ProjectController(FeedController): username=user.username, url=user.url(), roles=', '.join(sorted(roles))) - if 'Admin' in roles: - admins.append(u) - elif 'Developer' in roles: - developers.append(u) - else: - users.append(u) + _user = user + _user['roles'] = ', '.join(sorted(roles)) + users.append(_user) get_username = lambda user: user['username'] - admins = sorted(admins, key=get_username) - developers = sorted(developers, key=get_username) users = sorted(users, key=get_username) - return dict(users=admins + developers + users) + return dict(users=users) def _check_security(self): require_access(c.project, 'read') @@ -401,7 +396,7 @@ class ProjectController(FeedController): if mount is not None: if hasattr(app, 'default_redirect'): app.default_redirect() - redirect(app.url() if callable(app.url) else app.url) # Application has property; Subproject has method + redirect(app.url() if callable(app.url) else app.url, redirect_with=exc.HTTPMovedPermanently) # Application has property; Subproject has method else: redirect(c.project.app_configs[0].url()) diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py index 7517cb6a5..6f8c642a7 100644 --- a/Allura/allura/lib/app_globals.py +++ b/Allura/allura/lib/app_globals.py @@ -581,7 +581,7 @@ class Globals: @property def user_profile_urls_with_profile_path(self): - return config['user_profile_url_with_profile_path'] + return asbool(config['user_profile_url_with_profile_path']) def app_static(self, resource, app=None): base = config['static.url_base'] diff --git a/Allura/allura/public/nf/js/allura-base.js b/Allura/allura/public/nf/js/allura-base.js index a4031d602..6d0171eb6 100644 --- a/Allura/allura/public/nf/js/allura-base.js +++ b/Allura/allura/public/nf/js/allura-base.js @@ -297,7 +297,7 @@ $(function(){ // load from cache } else { - $.get(userUrl + 'profile/user_card', function(data) { + $.get(userUrl + 'user_card', function(data) { displayUserCard(instance, data); umProfileStore[userUrl] = data; }); diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html index 3aa3366ca..0af3f490e 100644 --- a/Allura/allura/templates/jinja_master/lib.html +++ b/Allura/allura/templates/jinja_master/lib.html @@ -109,11 +109,11 @@ {% endif %} {%- endmacro %} -{% macro user_link(user, avatar=False, size=16) -%} +{% macro user_link(user, avatar=False, size=16, nofollow=False) -%} {% if user %} {% if not user.is_anonymous() %} - {% set profile_path = user.url() + 'profile/' if g.user_profile_urls_with_profile_path == 'true' else user.url() %} - <a href="{{profile_path}}" class="user-mention"> + {% set profile_path = user.url() + 'profile/' if g.user_profile_urls_with_profile_path else user.url() %} + <a href="{{profile_path}}" class="user-mention" {% if nofollow %}rel="nofollow" {% endif %}> {% if avatar %} {{ gravatar_or_name(user, size) }} {% else %} diff --git a/Allura/allura/templates/macro/members.html b/Allura/allura/templates/macro/members.html index a3e3db472..8f7a874e5 100644 --- a/Allura/allura/templates/macro/members.html +++ b/Allura/allura/templates/macro/members.html @@ -18,7 +18,7 @@ -#} <h6>Project Members:</h6> <ul class="md-users-list"> - {% set profile_path = 'profile/' if g.user_profile_urls_with_profile_path == 'true' else '' %} + {% set profile_path = 'profile/' if g.user_profile_urls_with_profile_path else '' %} {% for user in users -%} <li><a href="{{ user.url ~ profile_path}}">{{user.name}}</a>{{user.admin}}</li> {%- endfor %} diff --git a/Allura/allura/templates/members.html b/Allura/allura/templates/members.html index 8088eb999..d77dbb368 100644 --- a/Allura/allura/templates/members.html +++ b/Allura/allura/templates/members.html @@ -16,9 +16,9 @@ specific language governing permissions and limitations under the License. -#} +{% import 'allura:templates/jinja_master/lib.html' as lib with context %} {% set hide_left_bar = True %} {% set h1_text = c.project.name ~ ' ' ~ 'Project' ~ ' ' ~ 'Member List' %} -{% set profile_path = 'profile/' if g.user_profile_urls_with_profile_path == 'true' else '' %} {% extends g.theme.master %} {% block title %}{{ h1_text }}{% endblock %} {% block header %}Members{% endblock %} @@ -36,7 +36,7 @@ {%for user in users%} <tr> <td>{{ user.display_name }}</td> - <td><a href="{{ user.url ~ profile_path }}">{{ user.username }}</a></td> + <td>{{ lib.user_link(user) }}</td> <td>{{user.roles}}</td> </tr> {%endfor%} diff --git a/Allura/allura/templates/repo/merge_requests.html b/Allura/allura/templates/repo/merge_requests.html index 8deeb118d..04acb7e11 100644 --- a/Allura/allura/templates/repo/merge_requests.html +++ b/Allura/allura/templates/repo/merge_requests.html @@ -19,7 +19,7 @@ {% extends 'allura:templates/repo/repo_master.html' %} {% import 'allura:templates/jinja_master/lib.html' as lib with context %} {% set status = request.params.get('status' , '') %} -{% set profile_path = 'profile/' if g.user_profile_urls_with_profile_path == 'true' else '' %} + {% block title %} {{c.project.name}} / {{c.app.config.options.mount_label}} / Merge Requests {% endblock %} @@ -61,7 +61,7 @@ {% else %} <i>(deleted)</i> {% endif %}</td> - <td><a href="{{req.creator_url ~ profile_path}}" rel="nofollow">{{req.creator_name}}</a></td> + <td> {{ lib.user_link(req.creator,nofollow=True) }}</td> <td>{{lib.abbr_date(req.created)}}</td> <td>{{lib.abbr_date(req.mod_date)}}</td> </tr>
