-
Notifications
You must be signed in to change notification settings - Fork 4
Add links to impersonate under "Debug" modal #612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
humitos
wants to merge
2
commits into
main
Choose a base branch
from
humitos/debug-impersonate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||||||
{% load blocktrans trans from i18n %} | ||||||||||
{% load is_admin from privacy_tags %} | ||||||||||
{% load is_admin admins from privacy_tags %} | ||||||||||
{% load gravatar_url from gravatar %} | ||||||||||
{% load get_spam_score readthedocs_language_name readthedocs_language_name_local from ext_theme_tags %} | ||||||||||
|
||||||||||
|
@@ -193,35 +193,59 @@ | |||||||||
</div> | ||||||||||
</div> | ||||||||||
|
||||||||||
<div class="ui mini modal" data-modal-id="project-debug"> | ||||||||||
<div class="header">{% trans "Debug information" %}</div> | ||||||||||
{% comment %} | ||||||||||
{% if user.is_staff %} | ||||||||||
<div class="ui mini modal" data-modal-id="project-debug"> | ||||||||||
<div class="header">{% trans "Debug information" %}</div> | ||||||||||
{% comment %} | ||||||||||
Show spam information on community instance. | ||||||||||
Allows us to quickly understand what's the spam score, | ||||||||||
and also know what rules are matching this project. | ||||||||||
{% endcomment %} | ||||||||||
<div class="content"> | ||||||||||
{% if not USE_ORGANIZATIONS %} | ||||||||||
<h3>{% trans "Spam" %}</h3> | ||||||||||
<div class="ui sub header">{% trans "Spam score" %}</div> | ||||||||||
<span>{{ project|get_spam_score }}</span> | ||||||||||
{% if project.spam_rules.exists %} | ||||||||||
<div class="ui sub header">{% trans "Spam matching rules" %}</div> | ||||||||||
{% endcomment %} | ||||||||||
<div class="content"> | ||||||||||
<h3>{% trans "Impersonate" %}</h3> | ||||||||||
<div class="ui sub header">{% trans "Project maintainer" %}</div> | ||||||||||
<div class="ui vertical list"> | ||||||||||
{% for user in project|admins %} | ||||||||||
<div class="item"> | ||||||||||
<a href="{{ ADMIN_URL|cut:"/admin" }}/impersonate/{{ user.pk }}/" target="_blank">{{ user.username }}</a> | ||||||||||
</div> | ||||||||||
Comment on lines
+209
to
+211
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to nest these elements, links can be items too:
Suggested change
|
||||||||||
{% endfor %} | ||||||||||
|
||||||||||
</div> | ||||||||||
|
||||||||||
{% if USE_ORGANIZATIONS %} | ||||||||||
<div class="ui sub header">{% trans "Organization owner" %}</div> | ||||||||||
<div class="ui vertical list"> | ||||||||||
{% for rule in project.spam_rules.all %} | ||||||||||
{% for owner in organization|admins %} | ||||||||||
<div class="item"> | ||||||||||
<a href="{{ ADMIN_URL }}/spamfighting/spamrule/{{ rule.pk }}/change/" | ||||||||||
target="_blank">{{ rule.spam_rule_type|cut:"readthedocsext.spamfighting.rules." }}</a> | ||||||||||
<a href="{{ ADMIN_URL|cut:"/admin" }}/impersonate/{{ owner.pk }}/" target="_blank">{{ owner.username }}</a> | ||||||||||
</div> | ||||||||||
{% endfor %} | ||||||||||
</div> | ||||||||||
{% endif %} | ||||||||||
{% endif %} | ||||||||||
</div> | ||||||||||
<div class="actions"> | ||||||||||
<a href="#" class="ui negative button">{% trans "Close" %}</a> | ||||||||||
|
||||||||||
{% if not USE_ORGANIZATIONS %} | ||||||||||
<h3>{% trans "Spam" %}</h3> | ||||||||||
<div class="ui sub header">{% trans "Spam score" %}</div> | ||||||||||
<span>{{ project|get_spam_score }}</span> | ||||||||||
{% if project.spam_rules.exists %} | ||||||||||
<div class="ui sub header">{% trans "Spam matching rules" %}</div> | ||||||||||
<div class="ui vertical list"> | ||||||||||
{% for rule in project.spam_rules.all %} | ||||||||||
<div class="item"> | ||||||||||
<a href="{{ ADMIN_URL }}/spamfighting/spamrule/{{ rule.pk }}/change/" | ||||||||||
target="_blank">{{ rule.spam_rule_type|cut:"readthedocsext.spamfighting.rules." }}</a> | ||||||||||
</div> | ||||||||||
{% endfor %} | ||||||||||
</div> | ||||||||||
{% endif %} | ||||||||||
{% endif %} | ||||||||||
</div> | ||||||||||
<div class="actions"> | ||||||||||
<a href="#" class="ui negative button">{% trans "Close" %}</a> | ||||||||||
</div> | ||||||||||
</div> | ||||||||||
</div> | ||||||||||
{% endif %} | ||||||||||
{% endblock project_header_navigation %} | ||||||||||
|
||||||||||
{% endblock project_header %} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To @stsewd point, we really only need one here. If there is a case for more than one, it seems reasonable to slice down to several results. There are projects/orgs with dozens of users.
You could also just link to the admin view of the filtered list of all org owners or project owners instead of duplicating this information in the application.