Bugfix admin redirect fixes (#587)

This commit is contained in:
mj2p 2023-06-14 18:15:29 +01:00 committed by GitHub
parent f88ad38294
commit bb8f589da7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 32 additions and 22 deletions

View file

@ -16,7 +16,7 @@
{% include "forms/_field.html" with field=form.end %} {% include "forms/_field.html" with field=form.end %}
</fieldset> </fieldset>
<div class="buttons"> <div class="buttons">
<a href="{{ announcement.urls.admin_root }}" class="button secondary left">Back</a> <a href="{{ announcement.urls.admin_root }}?page={{ page }}" class="button secondary left">Back</a>
<a href="{{ announcement.urls.admin_delete }}" class="button delete">Delete</a> <a href="{{ announcement.urls.admin_delete }}" class="button delete">Delete</a>
<button>Save</button> <button>Save</button>
</div> </div>

View file

@ -10,11 +10,11 @@
{% for announcement in page_obj %} {% for announcement in page_obj %}
<tr> <tr>
<td class="icon"> <td class="icon">
<a href="{{ announcement.urls.admin_edit }}" class="overlay"></a> <a href="{{ announcement.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
<i class="fa-solid fa-bullhorn"></i> <i class="fa-solid fa-bullhorn"></i>
</td> </td>
<td class="name"> <td class="name">
<a href="{{ announcement.urls.admin_edit }}" class="overlay"></a> <a href="{{ announcement.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
{{ announcement.html|truncatewords_html:"10" }} {{ announcement.html|truncatewords_html:"10" }}
<small> <small>
{% if announcement.service_announcement %}{{ domain.service_domain }}{% endif %} {% if announcement.service_announcement %}{{ domain.service_domain }}{% endif %}

View file

@ -12,11 +12,11 @@
{% for domain in page_obj %} {% for domain in page_obj %}
<tr> <tr>
<td class="icon"> <td class="icon">
<a href="{{ domain.urls.edit_federation }}" class="overlay"></a> <a href="{{ domain.urls.edit_federation }}?page={{ page_obj.number }}" class="overlay"></a>
<i class="fa-solid fa-globe"></i> <i class="fa-solid fa-globe"></i>
</td> </td>
<td class="name"> <td class="name">
<a href="{{ domain.urls.edit_federation }}" class="overlay"></a> <a href="{{ domain.urls.edit_federation }}?page={{ page_obj.number }}" class="overlay"></a>
{{ domain.domain }} {{ domain.domain }}
<small>{{ domain.software }}</small> <small>{{ domain.software }}</small>
</td> </td>

View file

@ -15,7 +15,7 @@
{% include "forms/_field.html" with field=form.notes %} {% include "forms/_field.html" with field=form.notes %}
</fieldset> </fieldset>
<div class="buttons"> <div class="buttons">
<a href="{{ domain.urls.root_federation }}" class="button secondary left">Back</a> <a href="{{ domain.urls.root_federation }}?page={{ page }}" class="button secondary left">Back</a>
<a href="{{ domain.urls.delete }}" class="button delete">Delete</a> <a href="{{ domain.urls.delete }}" class="button delete">Delete</a>
<button>Save</button> <button>Save</button>
</div> </div>

View file

@ -38,7 +38,7 @@
</div> </div>
</fieldset> </fieldset>
<div class="buttons"> <div class="buttons">
<a href="{{ hashtag.urls.admin }}" class="button secondary left">Back</a> <a href="{{ hashtag.urls.admin }}?page={{ page }}" class="button secondary left">Back</a>
<a href="{{ hashtag.urls.timeline }}" class="button secondary">View Posts</a> <a href="{{ hashtag.urls.timeline }}" class="button secondary">View Posts</a>
<button>Save</button> <button>Save</button>
</div> </div>

View file

@ -7,11 +7,11 @@
{% for hashtag in page_obj %} {% for hashtag in page_obj %}
<tr> <tr>
<td class="icon"> <td class="icon">
<a href="{{ hashtag.urls.admin_edit }}" class="overlay"></a> <a href="{{ hashtag.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
<i class="fa-solid fa-hashtag"></i> <i class="fa-solid fa-hashtag"></i>
</td> </td>
<td class="name"> <td class="name">
<a href="{{ hashtag.urls.admin_edit }}" class="overlay"></a> <a href="{{ hashtag.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
{{ hashtag.display_name }} {{ hashtag.display_name }}
<small>{% if hashtag.public %}Public{% elif hashtag.public is None %}Unreviewed{% else %}Private{% endif %}</small> <small>{% if hashtag.public %}Public{% elif hashtag.public is None %}Unreviewed{% else %}Private{% endif %}</small>
</td> </td>

View file

@ -22,7 +22,7 @@
{% for identity in page_obj %} {% for identity in page_obj %}
<tr> <tr>
<td class="icon"> <td class="icon">
<a href="{{ identity.urls.admin_edit }}" class="overlay"></a> <a href="{{ identity.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
<img <img
src="{{ identity.local_icon_url.relative }}" src="{{ identity.local_icon_url.relative }}"
class="icon" class="icon"
@ -33,7 +33,7 @@
> >
</td> </td>
<td class="name"> <td class="name">
<a href="{{ identity.urls.admin_edit }}" class="overlay"></a> <a href="{{ identity.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
{{ identity.html_name_or_handle }} {{ identity.html_name_or_handle }}
<small>@{{ identity.handle }}</small> <small>@{{ identity.handle }}</small>
</td> </td>

View file

@ -115,7 +115,7 @@
{% endif %} {% endif %}
</div> </div>
<div class="buttons"> <div class="buttons">
<a href="{{ identity.urls.admin }}" class="button secondary left">Back</a> <a href="{{ identity.urls.admin }}?page={{ page }}" class="button secondary left">Back</a>
<a href="{{ identity.urls.view }}" class="button secondary">View Profile</a> <a href="{{ identity.urls.view }}" class="button secondary">View Profile</a>
<button>Save Notes</button> <button>Save Notes</button>
</div> </div>

View file

@ -13,7 +13,7 @@
{% include "forms/_field.html" with field=form.notes %} {% include "forms/_field.html" with field=form.notes %}
</fieldset> </fieldset>
<div class="buttons"> <div class="buttons">
<a href="{% url "admin_invites" %}" class="button secondary left">Back</a> <a href="{% url 'admin_invites' %}?page={{ page }}" class="button secondary left">Back</a>
<button class="delete" name="delete">Delete</button> <button class="delete" name="delete">Delete</button>
<button>Save</button> <button>Save</button>
</div> </div>

View file

@ -12,11 +12,11 @@
{% for invite in page_obj %} {% for invite in page_obj %}
<tr> <tr>
<td class="icon"> <td class="icon">
<a href="{{ invite.urls.admin_view }}" class="overlay"></a> <a href="{{ invite.urls.admin_view }}?page={{ page_obj.number }}" class="overlay"></a>
<i class="fa-solid fa-envelope"></i> <i class="fa-solid fa-envelope"></i>
</td> </td>
<td class="name"> <td class="name">
<a href="{{ invite.urls.admin_view }}" class="overlay"></a> <a href="{{ invite.urls.admin_view }}?page={{ page_obj.number }}" class="overlay"></a>
{{ invite.token }} {{ invite.token }}
<small> <small>
{% if invite.note %} {% if invite.note %}

View file

@ -77,7 +77,7 @@
</table> </table>
</fieldset> </fieldset>
<div class="buttons"> <div class="buttons">
<a href="{{ report.urls.admin }}" class="button secondary left">Back</a> <a href="{{ report.urls.admin }}?page={{ page }}" class="button secondary left">Back</a>
<a href="{{ report.subject_identity.urls.view }}" class="button secondary">View Profile</a> <a href="{{ report.subject_identity.urls.view }}" class="button secondary">View Profile</a>
<a href="{{ report.subject_identity.urls.admin_edit }}" class="button secondary">Identity Admin</a> <a href="{{ report.subject_identity.urls.admin_edit }}" class="button secondary">Identity Admin</a>
<button>Save Notes</button> <button>Save Notes</button>

View file

@ -15,11 +15,11 @@
{% for report in page_obj %} {% for report in page_obj %}
<tr> <tr>
<td class="icon"> <td class="icon">
<a href="{{ report.urls.admin_view }}" class="overlay"></a> <a href="{{ report.urls.admin_view }}?page={{ page_obj.number }}" class="overlay"></a>
<img src="{{ report.subject_identity.local_icon_url.relative }}" class="icon" alt="Avatar for {{ report.subject_identity.name_or_handle }}"> <img src="{{ report.subject_identity.local_icon_url.relative }}" class="icon" alt="Avatar for {{ report.subject_identity.name_or_handle }}">
</td> </td>
<td class="name"> <td class="name">
<a href="{{ report.urls.admin_view }}" class="overlay"></a> <a href="{{ report.urls.admin_view }}?page={{ page_obj.number }}" class="overlay"></a>
{{ report.subject_identity.html_name_or_handle }} {{ report.subject_identity.html_name_or_handle }}
{% if report.subject_post %} {% if report.subject_post %}
<small> <small>

View file

@ -29,7 +29,7 @@
<p>Created: <time title="{{ editing_user.created }} UTC">{{ editing_user.created | timesince }} ago</time></p> <p>Created: <time title="{{ editing_user.created }} UTC">{{ editing_user.created | timesince }} ago</time></p>
</fieldset> </fieldset>
<div class="buttons"> <div class="buttons">
<a href="{{ editing_user.urls.admin }}" class="button secondary left">Back</a> <a href="{{ editing_user.urls.admin }}?page={{ page }}" class="button secondary left">Back</a>
<button>Save</button> <button>Save</button>
</div> </div>
</form> </form>

View file

@ -12,11 +12,11 @@
{% for user in page_obj %} {% for user in page_obj %}
<tr> <tr>
<td class="icon"> <td class="icon">
<a href="{{ user.urls.admin_edit }}" class="overlay"></a> <a href="{{ user.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
<i class="fa-solid fa-user"></i> <i class="fa-solid fa-user"></i>
</td> </td>
<td class="name"> <td class="name">
<a href="{{ user.urls.admin_edit }}" class="overlay"></a> <a href="{{ user.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
{{ user.email }} {{ user.email }}
<small>{% if user.admin %}Admin{% elif user.moderator %}Moderator{% endif %}</small> <small>{% if user.admin %}Admin{% elif user.moderator %}Moderator{% endif %}</small>
</td> </td>

View file

@ -49,7 +49,11 @@ class AnnouncementEdit(UpdateView):
model = Announcement model = Announcement
template_name = "admin/announcement_edit.html" template_name = "admin/announcement_edit.html"
extra_context = {"section": "announcements"} extra_context = {"section": "announcements"}
success_url = Announcement.urls.admin_root
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["page"] = self.request.GET.get("page")
return context
class form_class(AnnouncementCreate.form_class): class form_class(AnnouncementCreate.form_class):
pass pass

View file

@ -64,6 +64,7 @@ class FederationEdit(FormView):
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
context = super().get_context_data(*args, **kwargs) context = super().get_context_data(*args, **kwargs)
context["domain"] = self.domain context["domain"] = self.domain
context["page"] = self.request.GET.get("page")
return context return context
def form_valid(self, form): def form_valid(self, form):

View file

@ -64,6 +64,7 @@ class HashtagEdit(FormView):
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
context = super().get_context_data(*args, **kwargs) context = super().get_context_data(*args, **kwargs)
context["hashtag"] = self.hashtag context["hashtag"] = self.hashtag
context["page"] = self.request.GET.get("page")
return context return context
def form_valid(self, form): def form_valid(self, form):

View file

@ -90,4 +90,5 @@ class IdentityEdit(FormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["identity"] = self.identity context["identity"] = self.identity
context["page"] = self.request.GET.get("page")
return context return context

View file

@ -106,4 +106,5 @@ class InviteView(FormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["invite"] = self.invite context["invite"] = self.invite
context["page"] = self.request.GET.get("page")
return context return context

View file

@ -77,4 +77,5 @@ class ReportView(FormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["report"] = self.report context["report"] = self.report
context["page"] = self.request.GET.get("page")
return context return context

View file

@ -81,4 +81,5 @@ class UserEdit(FormView):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["editing_user"] = self.user context["editing_user"] = self.user
context["same_user"] = self.user == self.request.user context["same_user"] = self.user == self.request.user
context["page"] = self.request.GET.get("page")
return context return context