You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by gc...@apache.org on 2022/07/18 20:10:13 UTC

[allura] branch gc/8446 updated (cf3c3b9d1 -> 7d897b3b3)

This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a change to branch gc/8446
in repository https://gitbox.apache.org/repos/asf/allura.git


 discard cf3c3b9d1 fixup! [#8446] fixed tooltip loading for profile links, converted new setting to boolean
 discard a3f3566c4 [#8446] fixed tooltip loading for profile links, converted new setting to boolean
 discard 7a2d9b6c3 fixup! [#8446] user links inside pages link directly to profile
 discard 6a309567c [#8446] user links inside pages link directly to profile
     add 67233a562 [#8445] Upgrade cryptography 36.0.2 -> 37.0.4, and its deps: cffi,pycparser
     add 8d449bfca [#8445] limit markupsafe; Upgrade EasyWidgets 0.4.1, and its deps: formencode,six,markupsafe,paste,setuptools,six,python-dateutil,six,six,webob
     add e3b321900 [#8445] Upgrade feedparser 6.0.8 -> 6.0.10, and its deps: sgmllib3k
     add fb830af8c [#8445] Upgrade Jinja2 3.1.1 -> 3.1.2, and its deps: markupsafe
     add 811886601 [#8445] Upgrade markdown 3.3.6 -> 3.3.7, and its deps: importlib-metadata,typing-extensions,zipp
     add d5724c0c7 [#8445] Upgrade Pillow 9.1.1 -> 9.2.0
     add 2247e50e1 [#8445] Upgrade Pygments 2.11.2 -> 2.12.0
     add c07cea512 [#8445] Upgrade Pypeline 0.6.0 -> no upgrade, and its deps: bleach,six,webencodings,html5lib,six,webencodings,Creoleparser,Genshi,six,six,markdown,importlib-metadata,typing-extensions,zipp,textile,html5lib,six,webencodings,regex
     add b45cd8d08 [#8445] Upgrade python-magic 0.4.25 -> 0.4.27
     add 967a275e4 [#8445] Upgrade setproctitle 1.2.2 -> 1.2.3
     add da4fa03df [#8445] Upgrade Werkzeug 2.1.1 -> 2.1.2
     add e8d2310e1 [#8445] Upgrade wrapt 1.14.0 -> 1.14.1
     add f0a23b4e5 Lower SVN import retry count significantly; block imports from plugins.svn.wordpress.org since it has millions of revisions
     add f0f2fed0d Add generic require_method helper, alongside require_post
     add 148ba11b0 update timermiddleware with perf improvement
     add fb976605c Only activate+enable users exactly when needed
     new 5256a46f9 [#8446] user links inside pages link directly to profile
     new 7d897b3b3 [#8446] fixed tooltip loading for profile links, converted new setting to boolean

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (cf3c3b9d1)
            \
             N -- N -- N   refs/heads/gc/8446 (7d897b3b3)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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/controllers/site_admin.py           | 14 +++++---
 Allura/allura/lib/decorators.py                   | 14 ++++++++
 Allura/allura/tests/functional/test_site_admin.py |  2 +-
 Allura/development.ini                            |  3 +-
 ForgeSVN/forgesvn/model/svn.py                    |  2 +-
 ForgeSVN/forgesvn/widgets.py                      |  7 ++++
 requirements.in                                   |  2 +-
 requirements.txt                                  | 42 +++++++++++------------
 8 files changed, 57 insertions(+), 29 deletions(-)


[allura] 02/02: [#8446] fixed tooltip loading for profile links, converted new setting to boolean

Posted by gc...@apache.org.
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 <gu...@slashdotmedia.com>
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>


[allura] 01/02: [#8446] user links inside pages link directly to profile

Posted by gc...@apache.org.
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 5256a46f9f63cf14fc8ca335f70296eaebdd9cab
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Fri Jul 8 11:45:11 2022 -0600

    [#8446] user links inside pages link directly to profile
---
 Allura/allura/lib/app_globals.py                          | 4 ++++
 Allura/allura/lib/helpers.py                              | 2 +-
 Allura/allura/templates/jinja_master/lib.html             | 3 ++-
 Allura/allura/templates/macro/members.html                | 3 ++-
 Allura/allura/templates/members.html                      | 3 ++-
 Allura/allura/templates/repo/merge_requests.html          | 6 +++---
 Allura/development.ini                                    | 3 +++
 ForgeActivity/forgeactivity/main.py                       | 2 ++
 ForgeActivity/forgeactivity/tests/functional/test_root.py | 2 +-
 ForgeWiki/forgewiki/tests/functional/test_root.py         | 2 +-
 10 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 4a958b19d..7517cb6a5 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -579,6 +579,10 @@ class Globals:
             base = request.scheme + base
         return base + resource
 
+    @property
+    def user_profile_urls_with_profile_path(self):
+        return config['user_profile_url_with_profile_path']
+
     def app_static(self, resource, app=None):
         base = config['static.url_base']
         app = app or c.app
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index c6ec0e973..bf7b4d04a 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -1291,4 +1291,4 @@ def username_project_url(user_or_username):
         user = user_or_username
         url = user.url()
 
-    return url
+    return f'{url}profile/'
diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index 41689b43f..3aa3366ca 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -112,7 +112,8 @@
 {% macro user_link(user, avatar=False, size=16) -%}
     {% if user %}
         {% if not user.is_anonymous() %}
-            <a href="{{user.url()}}" class="user-mention">
+            {% 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">
                 {% 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 8ed27fcfb..a3e3db472 100644
--- a/Allura/allura/templates/macro/members.html
+++ b/Allura/allura/templates/macro/members.html
@@ -18,8 +18,9 @@
 -#}
 <h6>Project Members:</h6>
 	<ul class="md-users-list">
+        {% set profile_path = 'profile/' if g.user_profile_urls_with_profile_path == 'true' else '' %}
 		{% for user in users -%}
-			<li><a href="{{user.url}}">{{user.name}}</a>{{user.admin}}</li>
+			<li><a href="{{ user.url ~ profile_path}}">{{user.name}}</a>{{user.admin}}</li>
 		{%- endfor %}
 		{% if over_limit -%}
 				<li class="md-users-list-more"><a href="{{c.project.url()}}_members">All Members</a></li>
diff --git a/Allura/allura/templates/members.html b/Allura/allura/templates/members.html
index 5b4edff8d..8088eb999 100644
--- a/Allura/allura/templates/members.html
+++ b/Allura/allura/templates/members.html
@@ -18,6 +18,7 @@
 -#}
 {% 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 %}
@@ -35,7 +36,7 @@
     {%for user in users%}
     <tr>
         <td>{{ user.display_name }}</td>
-        <td><a href="{{ user.url }}">{{ user.username }}</a></td>
+        <td><a href="{{ user.url ~ profile_path }}">{{ user.username }}</a></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 8ca297ca7..8deeb118d 100644
--- a/Allura/allura/templates/repo/merge_requests.html
+++ b/Allura/allura/templates/repo/merge_requests.html
@@ -17,9 +17,9 @@
        under the License.
 -#}
 {% 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}}" rel="nofollow">{{req.creator_name}}</a></td>
+        <td><a href="{{req.creator_url ~ profile_path}}" rel="nofollow">{{req.creator_name}}</a></td>
         <td>{{lib.abbr_date(req.created)}}</td>
         <td>{{lib.abbr_date(req.mod_date)}}</td>
       </tr>
diff --git a/Allura/development.ini b/Allura/development.ini
index 12332a257..9787444fa 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -253,6 +253,9 @@ user_prefs.maximum_claimed_emails = 20
 ; Control the order of sections on the user profile page
 user_profile_sections.order = activity, personal-data, skills, social, tools, projects
 
+# append /profile to user profile's urls
+user_profile_url_with_profile_path = true
+
 ; Control the order of sections on the personal dashboard page
 personal_dashboard_sections.order = activity, tickets, merge_requests, projects
 
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index a1155a72d..d074f02fc 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -149,6 +149,8 @@ class ForgeActivityController(BaseController):
                     t.actor.activity_extras.icon_url = re.sub(r'([&?])d=[^&]*',
                                                               r'\1d={}'.format(default_avatar),
                                                               t.actor.activity_extras.icon_url)
+            t.actor.activity_url = f'{t.actor.activity_url}profile/'
+
             should_noindex = any(name in noindex_tags for name in t.tags)
             t.obj.noindex = should_noindex
             t.target.noindex = should_noindex
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_root.py b/ForgeActivity/forgeactivity/tests/functional/test_root.py
index cdbf679af..2948e560b 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_root.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_root.py
@@ -101,7 +101,7 @@ class TestActivityController(TestController):
         h1 = """\
         <h1>
          <img alt="Administrator 1" class="emboss x32 avatar" src="/u/test-admin/user_icon" title="Administrator 1"/>
-         <a href="/u/test-admin/">
+         <a href="/u/test-admin/profile/">
           Administrator 1
          </a>
          posted
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 698e0feb3..6c98b5ffc 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -830,7 +830,7 @@ class TestRootController(TestController):
 
     def test_user_browse_page(self):
         r = self.app.get('/wiki/browse_pages/')
-        assert '<td><a href="/u/test-admin/" class="user-mention">test-admin</a></td>' in r
+        assert '<td><a href="/u/test-admin/profile/" class="user-mention">test-admin</a></td>' in r
 
     def test_subscribe(self):
         user = M.User.query.get(username='test-user')