You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/05/21 21:17:43 UTC
[allura] branch master updated (93c1d52 -> 96822be)
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git.
from 93c1d52 Update jinja2 in req-dev.txt to match main version in req.txt
new 90373b9 wiki_username remove displayname from wiki history/browse
new 96822be wiki_username fix username url, user cards, added to issues
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
Allura/allura/lib/helpers.py | 11 +++++++++++
Allura/allura/public/nf/js/allura-base.js | 3 +++
Allura/allura/templates/jinja_master/lib.html | 2 +-
.../templates/tracker_widgets/ticket_search_results.html | 2 +-
ForgeWiki/forgewiki/templates/wiki/browse.html | 4 ++--
ForgeWiki/forgewiki/templates/wiki/page_history.html | 7 +++++--
ForgeWiki/forgewiki/tests/functional/test_root.py | 10 +++++-----
7 files changed, 28 insertions(+), 11 deletions(-)
[allura] 01/02: wiki_username remove displayname from wiki
history/browse
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 90373b939aa8757f56897a02e7b29581fa047d91
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Thu May 21 16:16:10 2020 +0000
wiki_username remove displayname from wiki history/browse
If a user removes or edits their displayname after making wiki changes,
their old displayname would remain forever in the history. This can pose
an issue for users seeking privacy.
Additionally, added links to the user's profile in these two places. And
to the version of the wiki page.
---
ForgeWiki/forgewiki/templates/wiki/browse.html | 4 ++--
ForgeWiki/forgewiki/templates/wiki/page_history.html | 2 +-
ForgeWiki/forgewiki/tests/functional/test_root.py | 10 +++++-----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/ForgeWiki/forgewiki/templates/wiki/browse.html b/ForgeWiki/forgewiki/templates/wiki/browse.html
index 98fbdd0..2a091c3 100644
--- a/ForgeWiki/forgewiki/templates/wiki/browse.html
+++ b/ForgeWiki/forgewiki/templates/wiki/browse.html
@@ -42,8 +42,8 @@
<tr class="{{'deleted ' if page.deleted else ''}}{{loop.cycle('', 'even')}}">
<td><a href="{{page.url|safe}}">{{page['title']}}</a></td>
- {% if 'user_label' in page %}
- <td>{{page['user_label']}} ({{page['user_name']}})</td>
+ {% if 'user_name' in page %}
+ <td><a href="/u/{{ page['user_name'] }}">{{page['user_name']}}</a></td>
{% else %}
<td></td>
{% endif %}
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_history.html b/ForgeWiki/forgewiki/templates/wiki/page_history.html
index 8b73362..8f4bb86 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_history.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_history.html
@@ -46,7 +46,7 @@
<tbody>
{% for p in pages %}
<tr>
- <td>{{p.version}} by {{p.author.display_name}} ({{p.author.username}})</td>
+ <td><a href="./?version={{ p.version }}">{{p.version}}</a> by <a href="/u/{{ p.author.username }}">{{ p.author.username }}</a></td>
<td>{{abbr_date(p.mod_date)}}</td>
<td><input name="v1" type="radio" value="{{p.version}}"/></td>
<td><input name="v2" type="radio" value="{{p.version}}"/></td>
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 19e4bae..823f663 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -249,16 +249,16 @@ class TestRootController(TestController):
response = self.app.get(h.urlquote('/wiki/tést/history'))
assert 'tést' in response
# two revisions are shown
- assert '2 by Test Admin' in response
- assert '1 by Test Admin' in response
+ assert '<td><a href="./?version=2">2</a> by <a href="/u/test-admin">test-admin</a></td>' in response
+ assert '1 by test-admin' in response.html.text
# you can revert to an old revison, but not the current one
assert response.html.find('a', {'data-dialog-id': '1'}), response.html
assert not response.html.find('a', {'data-dialog-id': '2'})
response = self.app.get(h.urlquote('/wiki/tést/history'),
extra_environ=dict(username=str('*anonymous')))
# two revisions are shown
- assert '2 by Test Admin' in response
- assert '1 by Test Admin' in response
+ assert '2 by test-admin' in response.html.text
+ assert '1 by test-admin' in response.html.text
# you cannot revert to any revision
assert not response.html.find('a', {'data-dialog-id': '1'})
assert not response.html.find('a', {'data-dialog-id': '2'})
@@ -838,7 +838,7 @@ class TestRootController(TestController):
def test_user_browse_page(self):
r = self.app.get('/wiki/browse_pages/')
- assert '<td>Test Admin (test-admin)</td>' in r
+ assert '<td><a href="/u/test-admin">test-admin</a></td>' in r
def test_subscribe(self):
user = M.User.query.get(username='test-user')
[allura] 02/02: wiki_username fix username url, user cards,
added to issues
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 96822bee587a41056b18c06d7defeaa54143714e
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Thu May 21 20:34:34 2020 +0000
wiki_username fix username url, user cards, added to issues
---
Allura/allura/lib/helpers.py | 11 +++++++++++
Allura/allura/public/nf/js/allura-base.js | 3 +++
Allura/allura/templates/jinja_master/lib.html | 2 +-
.../templates/tracker_widgets/ticket_search_results.html | 2 +-
ForgeWiki/forgewiki/templates/wiki/browse.html | 2 +-
ForgeWiki/forgewiki/templates/wiki/page_history.html | 7 +++++--
ForgeWiki/forgewiki/tests/functional/test_root.py | 10 +++++-----
7 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 4007ed2..e104353 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -1284,3 +1284,14 @@ def emojize(text):
def get_current_reaction(react_users_dict):
"""Return current selected reaction for given react_users dict"""
return utils.get_key_from_value(react_users_dict, c.user.username)
+
+
+def user_project_url(username):
+ from allura.lib import plugin
+
+ class UserName:
+ def __init__(self, username):
+ self.username = username
+
+ auth_provider = plugin.AuthenticationProvider.get(request)
+ return auth_provider.user_project_url(UserName(username))
\ No newline at end of file
diff --git a/Allura/allura/public/nf/js/allura-base.js b/Allura/allura/public/nf/js/allura-base.js
index 66600cd..6a4fd10 100644
--- a/Allura/allura/public/nf/js/allura-base.js
+++ b/Allura/allura/public/nf/js/allura-base.js
@@ -287,6 +287,9 @@ $(function(){
content: 'Loading...',
functionReady: function (instance, helper) {
var userUrl = $(this).attr('href');
+ if($(this).data('user-url')){
+ userUrl = $(this).data('user-url');
+ }
if(umProfileStore.hasOwnProperty(userUrl)){
displayUserCard(instance, umProfileStore[userUrl]);
diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index a0a3c67..ee70c53 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -112,7 +112,7 @@
{% macro user_link(user, avatar=False, size=16) -%}
{% if user %}
{% if not user.is_anonymous() %}
- <a href="{{user.url()}}">
+ <a href="{{user.url()}}" class="user-mention">
{% if avatar %}
{{ gravatar_or_name(user, size) }}
{% else %}
diff --git a/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html b/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
index 251336b..6d5ff06 100644
--- a/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
+++ b/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_search_results.html
@@ -67,7 +67,7 @@
<td class="{{t.open_or_closed}}">{{t.status}}</td>
{% elif col['name'] == 'assigned_to' %}
<td>{% if t.assigned_to_id %}
- <a href="{{c.app.url}}search?q=assigned_to:%22{{h.urlquoteplus(t.assigned_to.username)}}%22">{{t.assigned_to.display_name}}</a>
+ <a href="{{c.app.url}}search?q=assigned_to:%22{{h.urlquoteplus(t.assigned_to.username)}}%22" data-user-url="{{ h.user_project_url(t.assigned_to.username) }}" class="user-mention">{{t.assigned_to.display_name}}</a>
{% endif %}</td>
{% elif col['name'] == 'reported_by' %}
<td>{% if t.reported_by %}{{t.reported_by.display_name}}{% endif %}</td>
diff --git a/ForgeWiki/forgewiki/templates/wiki/browse.html b/ForgeWiki/forgewiki/templates/wiki/browse.html
index 2a091c3..408f17e 100644
--- a/ForgeWiki/forgewiki/templates/wiki/browse.html
+++ b/ForgeWiki/forgewiki/templates/wiki/browse.html
@@ -43,7 +43,7 @@
<td><a href="{{page.url|safe}}">{{page['title']}}</a></td>
{% if 'user_name' in page %}
- <td><a href="/u/{{ page['user_name'] }}">{{page['user_name']}}</a></td>
+ <td><a href="{{ h.user_project_url(page['user_name']) }}" class="user-mention">{{ page['user_name'] }}</a></td>
{% else %}
<td></td>
{% endif %}
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_history.html b/ForgeWiki/forgewiki/templates/wiki/page_history.html
index 8f4bb86..edef780 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_history.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_history.html
@@ -45,8 +45,11 @@
</thead>
<tbody>
{% for p in pages %}
- <tr>
- <td><a href="./?version={{ p.version }}">{{p.version}}</a> by <a href="/u/{{ p.author.username }}">{{ p.author.username }}</a></td>
+ <tr data-version="{{ p.version }}" data-username="{{ p.author.username }}">
+ <td>
+ <a href="./?version={{ p.version }}">{{ p.version }}</a> by
+ <a href="{{ h.user_project_url(p.author.username) }}" class="user-mention">{{ p.author.username }}</a>
+ </td>
<td>{{abbr_date(p.mod_date)}}</td>
<td><input name="v1" type="radio" value="{{p.version}}"/></td>
<td><input name="v2" type="radio" value="{{p.version}}"/></td>
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 823f663..7ea79bc 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -249,16 +249,16 @@ class TestRootController(TestController):
response = self.app.get(h.urlquote('/wiki/tést/history'))
assert 'tést' in response
# two revisions are shown
- assert '<td><a href="./?version=2">2</a> by <a href="/u/test-admin">test-admin</a></td>' in response
- assert '1 by test-admin' in response.html.text
+ assert '<tr data-version="2" data-username="test-admin">' in response
+ assert '<tr data-version="1" data-username="test-admin">' in response
# you can revert to an old revison, but not the current one
assert response.html.find('a', {'data-dialog-id': '1'}), response.html
assert not response.html.find('a', {'data-dialog-id': '2'})
response = self.app.get(h.urlquote('/wiki/tést/history'),
extra_environ=dict(username=str('*anonymous')))
# two revisions are shown
- assert '2 by test-admin' in response.html.text
- assert '1 by test-admin' in response.html.text
+ assert '<tr data-version="2" data-username="test-admin">' in response
+ assert '<tr data-version="1" data-username="test-admin">' in response
# you cannot revert to any revision
assert not response.html.find('a', {'data-dialog-id': '1'})
assert not response.html.find('a', {'data-dialog-id': '2'})
@@ -838,7 +838,7 @@ class TestRootController(TestController):
def test_user_browse_page(self):
r = self.app.get('/wiki/browse_pages/')
- assert '<td><a href="/u/test-admin">test-admin</a></td>' in r
+ assert '<td><a href="/u/test-admin/" class="user-mention">test-admin</a></td>' in r
def test_subscribe(self):
user = M.User.query.get(username='test-user')