forked from mirrors/bookwyrm
Small fixes
This commit is contained in:
parent
d05ca64488
commit
591f0ccf5d
3 changed files with 12 additions and 5 deletions
|
@ -191,16 +191,18 @@ def handle_outgoing_follow(user, to_follow):
|
||||||
|
|
||||||
def handle_response(response):
|
def handle_response(response):
|
||||||
''' hopefully it's an accept from our follow request '''
|
''' hopefully it's an accept from our follow request '''
|
||||||
activity = response.json()
|
try:
|
||||||
if not activity:
|
activity = response.json()
|
||||||
|
except ValueError:
|
||||||
return
|
return
|
||||||
if activity['type'] == 'Accept':
|
if activity['type'] == 'Accept':
|
||||||
handle_incoming_accept(activity)
|
handle_incoming_accept(activity)
|
||||||
|
|
||||||
def handle_incoming_accept(activity):
|
def handle_incoming_accept(activity):
|
||||||
''' someone is accepting a follow request '''
|
''' someone is accepting a follow request '''
|
||||||
# remote user who said yes
|
# not actually a remote user so this is kinda janky
|
||||||
user = get_or_create_remote_user(activity['actor'])
|
user = get_or_create_remote_user(activity['actor'])
|
||||||
|
# the person our local user wants to follow, who said yes
|
||||||
followed = models.User.objects.get(actor=activity['object']['actor'])
|
followed = models.User.objects.get(actor=activity['object']['actor'])
|
||||||
followed.followers.add(user)
|
followed.followers.add(user)
|
||||||
models.FollowActivity(
|
models.FollowActivity(
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
|
|
||||||
<div class="reviews">
|
<div class="reviews">
|
||||||
<h2>Reviews</h2>
|
<h2>Reviews</h2>
|
||||||
|
{% if not reviews %}
|
||||||
|
<p>No reviews yet!</p>
|
||||||
|
{% endif %}
|
||||||
{% for review in reviews %}
|
{% for review in reviews %}
|
||||||
<p><span class="review-title">{{ review.name }}</span>{{ review.rating }} stars, by {{ review.user.username }}</p>
|
<p><span class="review-title">{{ review.name }}</span>{{ review.rating }} stars, by {{ review.user.username }}</p>
|
||||||
<p>{{ review.review_content }}</p>
|
<p>{{ review.review_content }}</p>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
</p>
|
</p>
|
||||||
<p>by <a href="" class="author">{{ book.authors.first.data.name }}</a></p>
|
<p>by <a href="" class="author">{{ book.authors.first.data.name }}</a></p>
|
||||||
{% if not book.user_shelves %}
|
{% if not book.user_shelves %}
|
||||||
<form name="shelve" action="/shelve/{{ request.user.username }}_to-read/{{ book.id }}" method="post">
|
<form name="shelve" action="/shelve/{{ request.user.localname }}_to-read/{{ book.id }}" method="post">
|
||||||
<input type="hidden" name="book" value="book.id"></input>
|
<input type="hidden" name="book" value="book.id"></input>
|
||||||
<input type="submit" value="want to read"></input>
|
<input type="submit" value="want to read"></input>
|
||||||
</form>
|
</form>
|
||||||
|
@ -38,7 +38,9 @@
|
||||||
<div class="update">
|
<div class="update">
|
||||||
<div class="user-preview">
|
<div class="user-preview">
|
||||||
<img class="user-pic" src="static/images/profile.jpg">
|
<img class="user-pic" src="static/images/profile.jpg">
|
||||||
<span><a href="" class="user">Mouse</a> did {{ activity.activity_type }} </span>
|
<span><a href="/user/{% if activity.user.localname %}{{ activity.user.localname }}{% else %}{{ activity.user.username }}{% endif %}" class="user">
|
||||||
|
{% if activity.user.localname %}{{ activity.user.localname }}{% else %}{{ activity.user.username }}{% endif %}</a>
|
||||||
|
did {{ activity.activity_type }} </span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue