Merge pull request #1739 from bookwyrm-social/notification-link

Don't do fancy javascript clicks on the notification page
This commit is contained in:
Mouse Reeve 2022-01-01 08:41:00 -08:00 committed by GitHub
commit cb3d224a5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 28 deletions

View file

@ -1,21 +0,0 @@
/* exported BlockHref */
let BlockHref = new (class {
constructor() {
document
.querySelectorAll("[data-href]")
.forEach((t) => t.addEventListener("click", this.followLink.bind(this)));
}
/**
* Follow a fake link
*
* @param {Event} event
* @return {undefined}
*/
followLink(event) {
const url = event.currentTarget.dataset.href;
window.location.href = url;
}
})();

View file

@ -1,12 +1,15 @@
{% load bookwyrm_tags %}
{% related_status notification as related_status %}
<div class="notification is-clickable {% if notification.id in unread %} is-primary{% endif %}" data-href="{% block primary_link %}{% endblock %}">
<div class="box is-shadowless has-background-white-ter {% if notification.id in unread %} is-primary{% endif %}">
<div class="columns is-mobile">
<div class="column is-narrow is-size-3 {% if notification.id in unread%}has-text-white{% else %}has-text-grey{% endif %}">
{% block icon %}{% endblock %}
<a class="has-text-dark" href="{% block primary_link %}{% endblock %}">
{% block icon %}{% endblock %}
</a>
</div>
<div class="column is-clipped">
<div class="block">
<div class="block content">
<p>
{% if notification.related_user %}
<a href="{{ notification.related_user.local_path }}">{% include 'snippets/avatar.html' with user=notification.related_user %}
@ -15,6 +18,7 @@
{% block description %}{% endblock %}
</p>
</div>
{% if related_status %}
<div class="block">
{% block preview %}{% endblock %}

View file

@ -46,7 +46,3 @@
{% endif %}
</div>
{% endblock %}
{% block scripts %}
<script src="{% static "js/block_href.js" %}?v={{ js_cache }}"></script>
{% endblock %}