diff --git a/pagure/api/issue.py b/pagure/api/issue.py index 3832bae..f09b2a5 100644 --- a/pagure/api/issue.py +++ b/pagure/api/issue.py @@ -136,7 +136,7 @@ def _check_private_issue_access(issue): ) -def _check_ticket_access(issue, assignee=False): +def _check_ticket_access(issue, assignee=False, open_access=False): """Check if user can access issue. Must be repo committer or author to see private issues. :param issue: issue object @@ -146,8 +146,11 @@ def _check_ticket_access(issue, assignee=False): """ # Private tickets require commit access _check_private_issue_access(issue) - # Public tickets require ticket access - error = not is_repo_user(issue.project) + + error = False + if not open_access: + # Public tickets require ticket access + error = not is_repo_user(issue.project) if assignee: if ( @@ -824,7 +827,8 @@ def api_change_status_issue(repo, issueid, username=None, namespace=None): _check_token(repo, project_token=False) issue = _get_issue(repo, issueid) - _check_ticket_access(issue, assignee=True) + open_access = repo.settings.get("open_metadata_access_to_all", False) + _check_ticket_access(issue, assignee=True, open_access=open_access) status = pagure.lib.get_issue_statuses(flask.g.session) form = pagure.forms.StatusForm( @@ -938,7 +942,8 @@ def api_change_milestone_issue(repo, issueid, username=None, namespace=None): _check_token(repo) issue = _get_issue(repo, issueid) - _check_ticket_access(issue) + open_access = repo.settings.get("open_metadata_access_to_all", False) + _check_ticket_access(issue, open_access=open_access) form = pagure.forms.MilestoneForm( milestones=repo.milestones.keys(), csrf_enabled=False @@ -1125,7 +1130,8 @@ def api_assign_issue(repo, issueid, username=None, namespace=None): _check_token(repo) issue = _get_issue(repo, issueid) - _check_ticket_access(issue, assignee=True) + open_access = repo.settings.get("open_metadata_access_to_all", False) + _check_ticket_access(issue, assignee=True, open_access=open_access) form = pagure.forms.AssignIssueForm(csrf_enabled=False) if form.validate_on_submit(): @@ -1312,7 +1318,8 @@ def api_update_custom_field( _check_token(repo) issue = _get_issue(repo, issueid) - _check_ticket_access(issue) + open_access = repo.settings.get("open_metadata_access_to_all", False) + _check_ticket_access(issue, open_access=open_access) fields = {k.name: k for k in repo.issue_keys} if field not in fields: @@ -1428,7 +1435,8 @@ def api_update_custom_fields(repo, issueid, username=None, namespace=None): _check_token(repo) issue = _get_issue(repo, issueid) - _check_ticket_access(issue) + open_access = repo.settings.get("open_metadata_access_to_all", False) + _check_ticket_access(issue, open_access=open_access) fields = get_request_data() diff --git a/pagure/lib/model.py b/pagure/lib/model.py index 02da8b4..e284a26 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -630,6 +630,7 @@ class Project(BASE): "notify_on_commit_flag": False, "issue_tracker_read_only": False, "disable_non_fast-forward_merges": False, + "open_metadata_access_to_all": False, } if self._settings: diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index 55f135d..cd40d61 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -18,7 +18,7 @@ {% block repo %}

- {% if g.authenticated and g.repo_user %} + {% if g.authenticated and (g.repo_user or open_access) %} {% endif %}
- {% if issue.private %} - - {% endif %} - {% if issue.status == 'Open' %} - - #{{issue.id}} - {% elif issue.status == 'Closed' %} - - #{{issue.id}} - {% endif %} - - {{ issue.title | noJS(ignore="img") | safe}} - - {% if g.repo_committer or ( - g.fas_user and g.fas_user.username == issue.user.username) %} - - - {% endif %} + {% if issue.private %} + + {% endif %} + {% if issue.status == 'Open' %} + + #{{issue.id}} + {% elif issue.status == 'Closed' %} + + #{{issue.id}} + {% endif %} + + {{ issue.title | noJS(ignore="img") | safe}} + + {% if g.repo_committer or ( + g.fas_user and g.fas_user.username == issue.user.username) %} + + + {% endif %}
@@ -119,7 +119,7 @@

+ + {% if subscribers %} +
+ {% for subscriber in subscribers %} + {{ + subscriber |avatar(size=30, css_class="pb-1") | safe + }} + {% endfor %} +
+ {% else %} +
No Subscribers
+ {% endif %}
{% endif %} @@ -609,32 +610,31 @@ namespace=repo.namespace, repo=repo.name, issueid=issueid) {% if issue.related_prs %}
-
-
- Related Pull Requests -
-
-
-
    - {% for pr in issue.related_prs %} -
  • - #{{pr.id}} - {{ pr.status if pr.status != 'Open' else 'Last updated' - }} {{ pr.last_updated | humanize }} -
  • - {% endfor %} -
+
+
+ Related Pull Requests
+
+
+
    + {% for pr in issue.related_prs %} +
  • + #{{pr.id}} + {{ pr.status if pr.status != 'Open' else 'Last updated' + }} {{ pr.last_updated | humanize }} +
  • + {% endfor %} +
+
{% endif %}
- @@ -1024,7 +1024,7 @@ function try_async_comment(form) {