Fix logged-out user page

This commit is contained in:
cuom1999 2024-04-12 00:04:07 -05:00
parent 361d3fc33a
commit 2f64c87d56

View file

@ -79,19 +79,21 @@
{% endblock %} {% endblock %}
{% block js_media %} {% block js_media %}
<script type="text/javascript"> {% if request.user.is_authenticated %}
$(function() { <script type="text/javascript">
$("#message-button").on("click", function() { $(function() {
$.get("{{ url('get_or_create_room') }}", { $("#message-button").on("click", function() {
"other": "{{ chat_param(request.profile, user) }}" $.get("{{ url('get_or_create_room') }}", {
}, function(response) { "other": "{{ chat_param(request.profile, user) }}"
window.location.href = response.url; }, function(response) {
}).fail(function(error) { window.location.href = response.url;
console.log("Error: ", error); }).fail(function(error) {
console.log("Error: ", error);
});
}); });
}); });
}); </script>
</script> {% endif %}
{% block user_js_media %}{% endblock %} {% block user_js_media %}{% endblock %}
{% endblock %} {% endblock %}
@ -102,7 +104,7 @@
<img src="{{ gravatar(user, 145) }}" width="145px" height="145px"> <img src="{{ gravatar(user, 145) }}" width="145px" height="145px">
</div> </div>
<br> <br>
{% if request.user != user.user %} {% if request.user.is_authenticated and request.profile != user %}
<form method="post" action="{{ url('user_toggle_follow', user.username) }}"> <form method="post" action="{{ url('user_toggle_follow', user.username) }}">
{% csrf_token %} {% csrf_token %}
<button class="small {{ 'unfollow' if followed else 'follow' }}" style="width:145px"> <button class="small {{ 'unfollow' if followed else 'follow' }}" style="width:145px">