Merge pull request #594 from mouse-reeve/broadcast-fixes
Refactors broadcasting
This commit is contained in:
@ -8,7 +8,7 @@ from .error import not_found_page, server_error_page
|
||||
from .federation import Federation
|
||||
from .feed import DirectMessage, Feed, Replies, Status
|
||||
from .follow import follow, unfollow
|
||||
from .follow import accept_follow_request, delete_follow_request, handle_accept
|
||||
from .follow import accept_follow_request, delete_follow_request
|
||||
from .goal import Goal
|
||||
from .import_data import Import, ImportStatus
|
||||
from .interaction import Favorite, Unfavorite, Boost, Unboost
|
||||
|
@ -46,6 +46,7 @@ class Login(View):
|
||||
# successful login
|
||||
login(request, user)
|
||||
user.last_active_date = timezone.now()
|
||||
user.save(broadcast=False)
|
||||
return redirect(request.GET.get('next', '/'))
|
||||
|
||||
# login errors
|
||||
|
@ -8,7 +8,6 @@ from django.views import View
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.activitypub import ActivitypubResponse
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from .helpers import is_api_request
|
||||
|
||||
|
||||
@ -62,5 +61,4 @@ class EditAuthor(View):
|
||||
return TemplateResponse(request, 'edit_author.html', data)
|
||||
author = form.save()
|
||||
|
||||
broadcast(request.user, author.to_update_activity(request.user))
|
||||
return redirect('/author/%s' % author.id)
|
||||
|
@ -8,7 +8,6 @@ from django.views import View
|
||||
from django.views.decorators.http import require_POST
|
||||
|
||||
from bookwyrm import models
|
||||
from bookwyrm.broadcast import broadcast
|
||||
|
||||
# pylint: disable= no-self-use
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
@ -22,15 +21,8 @@ class Block(View):
|
||||
def post(self, request, user_id):
|
||||
''' block a user '''
|
||||
to_block = get_object_or_404(models.User, id=user_id)
|
||||
block = models.UserBlocks.objects.create(
|
||||
models.UserBlocks.objects.create(
|
||||
user_subject=request.user, user_object=to_block)
|
||||
if not to_block.local:
|
||||
broadcast(
|
||||
request.user,
|
||||
block.to_activity(),
|
||||
privacy='direct',
|
||||
direct_recipients=[to_block]
|
||||
)
|
||||
return redirect('/preferences/block')
|
||||
|
||||
|
||||
@ -46,13 +38,5 @@ def unblock(request, user_id):
|
||||
)
|
||||
except models.UserBlocks.DoesNotExist:
|
||||
return HttpResponseNotFound()
|
||||
|
||||
if not to_unblock.local:
|
||||
broadcast(
|
||||
request.user,
|
||||
block.to_undo_activity(request.user),
|
||||
privacy='direct',
|
||||
direct_recipients=[to_unblock]
|
||||
)
|
||||
block.delete()
|
||||
return redirect('/preferences/block')
|
||||
|
@ -12,7 +12,6 @@ from django.views.decorators.http import require_POST
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.activitypub import ActivitypubResponse
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from bookwyrm.connectors import connector_manager
|
||||
from bookwyrm.settings import PAGE_LENGTH
|
||||
from .helpers import is_api_request, get_activity_feed, get_edition
|
||||
@ -78,12 +77,12 @@ class Book(View):
|
||||
.order_by('-updated_date')
|
||||
|
||||
user_shelves = models.ShelfBook.objects.filter(
|
||||
added_by=request.user, book=book
|
||||
user=request.user, book=book
|
||||
)
|
||||
|
||||
other_edition_shelves = models.ShelfBook.objects.filter(
|
||||
~Q(book=book),
|
||||
added_by=request.user,
|
||||
user=request.user,
|
||||
book__parent_work=book.parent_work,
|
||||
)
|
||||
|
||||
@ -136,7 +135,6 @@ class EditBook(View):
|
||||
return TemplateResponse(request, 'edit_book.html', data)
|
||||
book = form.save()
|
||||
|
||||
broadcast(request.user, book.to_update_activity(request.user))
|
||||
return redirect('/book/%s' % book.id)
|
||||
|
||||
|
||||
@ -170,7 +168,6 @@ def upload_cover(request, book_id):
|
||||
book.cover = form.files['cover']
|
||||
book.save()
|
||||
|
||||
broadcast(request.user, book.to_update_activity(request.user))
|
||||
return redirect('/book/%s' % book.id)
|
||||
|
||||
|
||||
@ -189,7 +186,6 @@ def add_description(request, book_id):
|
||||
book.description = description
|
||||
book.save()
|
||||
|
||||
broadcast(request.user, book.to_update_activity(request.user))
|
||||
return redirect('/book/%s' % book.id)
|
||||
|
||||
|
||||
@ -215,12 +211,14 @@ def switch_edition(request):
|
||||
shelf__user=request.user
|
||||
)
|
||||
for shelfbook in shelfbooks.all():
|
||||
broadcast(request.user, shelfbook.to_remove_activity(request.user))
|
||||
|
||||
shelfbook.book = new_edition
|
||||
shelfbook.save()
|
||||
|
||||
broadcast(request.user, shelfbook.to_add_activity(request.user))
|
||||
with transaction.atomic():
|
||||
models.ShelfBook.objects.create(
|
||||
created_date=shelfbook.created_date,
|
||||
user=shelfbook.user,
|
||||
shelf=shelfbook.shelf,
|
||||
book=new_edition
|
||||
)
|
||||
shelfbook.delete()
|
||||
|
||||
readthroughs = models.ReadThrough.objects.filter(
|
||||
book__parent_work=new_edition.parent_work,
|
||||
|
@ -1,12 +1,10 @@
|
||||
''' views for actions you can take in the application '''
|
||||
from django.db import transaction
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpResponseBadRequest
|
||||
from django.shortcuts import redirect
|
||||
from django.views.decorators.http import require_POST
|
||||
|
||||
from bookwyrm import models
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from .helpers import get_user_from_username
|
||||
|
||||
@login_required
|
||||
@ -19,13 +17,10 @@ def follow(request):
|
||||
except models.User.DoesNotExist:
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
relationship, _ = models.UserFollowRequest.objects.get_or_create(
|
||||
models.UserFollowRequest.objects.get_or_create(
|
||||
user_subject=request.user,
|
||||
user_object=to_follow,
|
||||
)
|
||||
activity = relationship.to_activity()
|
||||
broadcast(
|
||||
request.user, activity, privacy='direct', direct_recipients=[to_follow])
|
||||
return redirect(to_follow.local_path)
|
||||
|
||||
|
||||
@ -39,14 +34,10 @@ def unfollow(request):
|
||||
except models.User.DoesNotExist:
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
relationship = models.UserFollows.objects.get(
|
||||
models.UserFollows.objects.get(
|
||||
user_subject=request.user,
|
||||
user_object=to_unfollow
|
||||
)
|
||||
activity = relationship.to_undo_activity(request.user)
|
||||
broadcast(
|
||||
request.user, activity,
|
||||
privacy='direct', direct_recipients=[to_unfollow])
|
||||
|
||||
to_unfollow.followers.remove(request.user)
|
||||
return redirect(to_unfollow.local_path)
|
||||
@ -70,24 +61,11 @@ def accept_follow_request(request):
|
||||
except models.UserFollowRequest.DoesNotExist:
|
||||
# Request already dealt with.
|
||||
return redirect(request.user.local_path)
|
||||
handle_accept(follow_request)
|
||||
follow_request.accept()
|
||||
|
||||
return redirect(request.user.local_path)
|
||||
|
||||
|
||||
def handle_accept(follow_request):
|
||||
''' send an acceptance message to a follow request '''
|
||||
user = follow_request.user_subject
|
||||
to_follow = follow_request.user_object
|
||||
with transaction.atomic():
|
||||
relationship = models.UserFollows.from_request(follow_request)
|
||||
follow_request.delete()
|
||||
relationship.save()
|
||||
|
||||
activity = relationship.to_accept_activity()
|
||||
broadcast(to_follow, activity, privacy='direct', direct_recipients=[user])
|
||||
|
||||
|
||||
@login_required
|
||||
@require_POST
|
||||
def delete_follow_request(request):
|
||||
@ -106,8 +84,5 @@ def delete_follow_request(request):
|
||||
except models.UserFollowRequest.DoesNotExist:
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
activity = follow_request.to_reject_activity()
|
||||
follow_request.delete()
|
||||
broadcast(
|
||||
request.user, activity, privacy='direct', direct_recipients=[requester])
|
||||
return redirect('/user/%s' % request.user.localname)
|
||||
|
@ -7,7 +7,6 @@ from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from bookwyrm.status import create_generated_note
|
||||
from .helpers import get_user_from_username, object_visible_to_user
|
||||
|
||||
@ -63,23 +62,10 @@ class Goal(View):
|
||||
|
||||
if request.POST.get('post-status'):
|
||||
# create status, if appropraite
|
||||
status = create_generated_note(
|
||||
create_generated_note(
|
||||
request.user,
|
||||
'set a goal to read %d books in %d' % (goal.goal, goal.year),
|
||||
privacy=goal.privacy
|
||||
)
|
||||
broadcast(
|
||||
request.user,
|
||||
status.to_create_activity(request.user),
|
||||
privacy=status.privacy,
|
||||
software='bookwyrm')
|
||||
|
||||
# re-format the activity for non-bookwyrm servers
|
||||
remote_activity = status.to_create_activity(request.user, pure=True)
|
||||
broadcast(
|
||||
request.user,
|
||||
remote_activity,
|
||||
privacy=status.privacy,
|
||||
software='other')
|
||||
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
@ -4,7 +4,6 @@ from requests import HTTPError
|
||||
from django.db.models import Q
|
||||
|
||||
from bookwyrm import activitypub, models
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from bookwyrm.connectors import ConnectorException, get_data
|
||||
from bookwyrm.status import create_generated_note
|
||||
from bookwyrm.utils import regex
|
||||
@ -199,7 +198,6 @@ def handle_reading_status(user, shelf, book, privacy):
|
||||
)
|
||||
status.save()
|
||||
|
||||
broadcast(user, status.to_create_activity(user))
|
||||
|
||||
def is_blocked(viewer, user):
|
||||
''' is this viewer blocked by the user? '''
|
||||
|
@ -7,7 +7,6 @@ from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
||||
from bookwyrm import models
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from bookwyrm.status import create_notification
|
||||
|
||||
|
||||
@ -19,7 +18,7 @@ class Favorite(View):
|
||||
''' create a like '''
|
||||
status = models.Status.objects.get(id=status_id)
|
||||
try:
|
||||
favorite = models.Favorite.objects.create(
|
||||
models.Favorite.objects.create(
|
||||
status=status,
|
||||
user=request.user
|
||||
)
|
||||
@ -27,10 +26,6 @@ class Favorite(View):
|
||||
# you already fav'ed that
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
fav_activity = favorite.to_activity()
|
||||
broadcast(
|
||||
request.user, fav_activity, privacy='direct',
|
||||
direct_recipients=[status.user])
|
||||
if status.user.local:
|
||||
create_notification(
|
||||
status.user,
|
||||
@ -56,9 +51,7 @@ class Unfavorite(View):
|
||||
# can't find that status, idk
|
||||
return HttpResponseNotFound()
|
||||
|
||||
fav_activity = favorite.to_undo_activity(request.user)
|
||||
favorite.delete()
|
||||
broadcast(request.user, fav_activity, direct_recipients=[status.user])
|
||||
|
||||
# check for notification
|
||||
if status.user.local:
|
||||
@ -86,15 +79,12 @@ class Boost(View):
|
||||
# you already boosted that.
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
boost = models.Boost.objects.create(
|
||||
models.Boost.objects.create(
|
||||
boosted_status=status,
|
||||
privacy=status.privacy,
|
||||
user=request.user,
|
||||
)
|
||||
|
||||
boost_activity = boost.to_activity()
|
||||
broadcast(request.user, boost_activity)
|
||||
|
||||
if status.user.local:
|
||||
create_notification(
|
||||
status.user,
|
||||
@ -114,10 +104,8 @@ class Unboost(View):
|
||||
boost = models.Boost.objects.filter(
|
||||
boosted_status=status, user=request.user
|
||||
).first()
|
||||
activity = boost.to_undo_activity(request.user)
|
||||
|
||||
boost.delete()
|
||||
broadcast(request.user, activity)
|
||||
|
||||
# delete related notification
|
||||
if status.user.local:
|
||||
|
@ -11,7 +11,6 @@ from django.views.decorators.http import require_POST
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.activitypub import ActivitypubResponse
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from bookwyrm.connectors import connector_manager
|
||||
from .helpers import is_api_request, object_visible_to_user, privacy_filter
|
||||
from .helpers import get_user_from_username
|
||||
@ -55,13 +54,6 @@ class Lists(View):
|
||||
return redirect('lists')
|
||||
book_list = form.save()
|
||||
|
||||
# let the world know
|
||||
broadcast(
|
||||
request.user,
|
||||
book_list.to_create_activity(request.user),
|
||||
privacy=book_list.privacy,
|
||||
software='bookwyrm'
|
||||
)
|
||||
return redirect(book_list.local_path)
|
||||
|
||||
class UserLists(View):
|
||||
@ -136,19 +128,12 @@ class List(View):
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
# pylint: disable=unused-argument
|
||||
def post(self, request, list_id):
|
||||
''' edit a book_list '''
|
||||
''' edit a list '''
|
||||
book_list = get_object_or_404(models.List, id=list_id)
|
||||
form = forms.ListForm(request.POST, instance=book_list)
|
||||
if not form.is_valid():
|
||||
return redirect('list', book_list.id)
|
||||
book_list = form.save()
|
||||
# let the world know
|
||||
broadcast(
|
||||
request.user,
|
||||
book_list.to_update_activity(request.user),
|
||||
privacy=book_list.privacy,
|
||||
software='bookwyrm'
|
||||
)
|
||||
return redirect(book_list.local_path)
|
||||
|
||||
|
||||
@ -182,13 +167,6 @@ class Curate(View):
|
||||
if approved:
|
||||
suggestion.approved = True
|
||||
suggestion.save()
|
||||
# let the world know
|
||||
broadcast(
|
||||
request.user,
|
||||
suggestion.to_add_activity(request.user),
|
||||
privacy=book_list.privacy,
|
||||
software='bookwyrm'
|
||||
)
|
||||
else:
|
||||
suggestion.delete()
|
||||
return redirect('list-curate', book_list.id)
|
||||
@ -205,17 +183,10 @@ def add_book(request, list_id):
|
||||
# do you have permission to add to the list?
|
||||
if request.user == book_list.user or book_list.curation == 'open':
|
||||
# go ahead and add it
|
||||
item = models.ListItem.objects.create(
|
||||
models.ListItem.objects.create(
|
||||
book=book,
|
||||
book_list=book_list,
|
||||
added_by=request.user,
|
||||
)
|
||||
# let the world know
|
||||
broadcast(
|
||||
request.user,
|
||||
item.to_add_activity(request.user),
|
||||
privacy=book_list.privacy,
|
||||
software='bookwyrm'
|
||||
user=request.user,
|
||||
)
|
||||
elif book_list.curation == 'curated':
|
||||
# make a pending entry
|
||||
@ -223,7 +194,7 @@ def add_book(request, list_id):
|
||||
approved=False,
|
||||
book=book,
|
||||
book_list=book_list,
|
||||
added_by=request.user,
|
||||
user=request.user,
|
||||
)
|
||||
else:
|
||||
# you can't add to this list, what were you THINKING
|
||||
@ -238,16 +209,8 @@ def remove_book(request, list_id):
|
||||
book_list = get_object_or_404(models.List, id=list_id)
|
||||
item = get_object_or_404(models.ListItem, id=request.POST.get('item'))
|
||||
|
||||
if not book_list.user == request.user and not item.added_by == request.user:
|
||||
if not book_list.user == request.user and not item.user == request.user:
|
||||
return HttpResponseNotFound()
|
||||
|
||||
activity = item.to_remove_activity(request.user)
|
||||
item.delete()
|
||||
# let the world know
|
||||
broadcast(
|
||||
request.user,
|
||||
activity,
|
||||
privacy=book_list.privacy,
|
||||
software='bookwyrm'
|
||||
)
|
||||
return redirect('list', list_id)
|
||||
|
@ -79,7 +79,7 @@ class PasswordReset(View):
|
||||
return TemplateResponse(request, 'password_reset.html', data)
|
||||
|
||||
user.set_password(new_password)
|
||||
user.save()
|
||||
user.save(broadcast=False)
|
||||
login(request, user)
|
||||
reset_code.delete()
|
||||
return redirect('/')
|
||||
@ -106,6 +106,6 @@ class ChangePassword(View):
|
||||
return redirect('preferences/password')
|
||||
|
||||
request.user.set_password(new_password)
|
||||
request.user.save()
|
||||
request.user.save(broadcast=False)
|
||||
login(request, request.user)
|
||||
return redirect(request.user.local_path)
|
||||
|
@ -9,7 +9,6 @@ from django.utils import timezone
|
||||
from django.views.decorators.http import require_POST
|
||||
|
||||
from bookwyrm import models
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from .helpers import get_edition, handle_reading_status
|
||||
from .shelf import handle_unshelve
|
||||
|
||||
@ -44,9 +43,8 @@ def start_reading(request, book_id):
|
||||
except models.Shelf.DoesNotExist:
|
||||
# this just means it isn't currently on the user's shelves
|
||||
pass
|
||||
shelfbook = models.ShelfBook.objects.create(
|
||||
book=book, shelf=shelf, added_by=request.user)
|
||||
broadcast(request.user, shelfbook.to_add_activity(request.user))
|
||||
models.ShelfBook.objects.create(
|
||||
book=book, shelf=shelf, user=request.user)
|
||||
|
||||
# post about it (if you want)
|
||||
if request.POST.get('post-status'):
|
||||
@ -82,9 +80,8 @@ def finish_reading(request, book_id):
|
||||
except models.Shelf.DoesNotExist:
|
||||
# this just means it isn't currently on the user's shelves
|
||||
pass
|
||||
shelfbook = models.ShelfBook.objects.create(
|
||||
book=book, shelf=shelf, added_by=request.user)
|
||||
broadcast(request.user, shelfbook.to_add_activity(request.user))
|
||||
models.ShelfBook.objects.create(
|
||||
book=book, shelf=shelf, user=request.user)
|
||||
|
||||
# post about it (if you want)
|
||||
if request.POST.get('post-status'):
|
||||
|
@ -9,7 +9,6 @@ from django.views.decorators.http import require_POST
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.activitypub import ActivitypubResponse
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from .helpers import is_api_request, get_edition, get_user_from_username
|
||||
from .helpers import handle_reading_status
|
||||
|
||||
@ -50,7 +49,7 @@ class Shelf(View):
|
||||
return ActivitypubResponse(shelf.to_activity(**request.GET))
|
||||
|
||||
books = models.ShelfBook.objects.filter(
|
||||
added_by=user, shelf=shelf
|
||||
user=user, shelf=shelf
|
||||
).order_by('-updated_date').all()
|
||||
|
||||
data = {
|
||||
@ -136,14 +135,8 @@ def shelve(request):
|
||||
except models.Shelf.DoesNotExist:
|
||||
# this just means it isn't currently on the user's shelves
|
||||
pass
|
||||
shelfbook = models.ShelfBook.objects.create(
|
||||
book=book, shelf=desired_shelf, added_by=request.user)
|
||||
broadcast(
|
||||
request.user,
|
||||
shelfbook.to_add_activity(request.user),
|
||||
privacy=shelfbook.shelf.privacy,
|
||||
software='bookwyrm'
|
||||
)
|
||||
models.ShelfBook.objects.create(
|
||||
book=book, shelf=desired_shelf, user=request.user)
|
||||
|
||||
# post about "want to read" shelves
|
||||
if desired_shelf.identifier == 'to-read':
|
||||
@ -168,10 +161,8 @@ def unshelve(request):
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
|
||||
#pylint: disable=unused-argument
|
||||
def handle_unshelve(user, book, shelf):
|
||||
''' unshelve a book '''
|
||||
row = models.ShelfBook.objects.get(book=book, shelf=shelf)
|
||||
activity = row.to_remove_activity(user)
|
||||
row.delete()
|
||||
|
||||
broadcast(user, activity, privacy=shelf.privacy, software='bookwyrm')
|
||||
|
@ -8,7 +8,6 @@ from django.views import View
|
||||
from markdown import markdown
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from bookwyrm.sanitize_html import InputHtmlParser
|
||||
from bookwyrm.settings import DOMAIN
|
||||
from bookwyrm.status import create_notification, delete_status
|
||||
@ -35,7 +34,7 @@ class CreateStatus(View):
|
||||
if not status.sensitive and status.content_warning:
|
||||
# the cw text field remains populated when you click "remove"
|
||||
status.content_warning = None
|
||||
status.save()
|
||||
status.save(broadcast=False)
|
||||
|
||||
# inspect the text for user tags
|
||||
content = status.content
|
||||
@ -83,16 +82,7 @@ class CreateStatus(View):
|
||||
if hasattr(status, 'quote'):
|
||||
status.quote = to_markdown(status.quote)
|
||||
|
||||
status.save()
|
||||
|
||||
broadcast(
|
||||
request.user,
|
||||
status.to_create_activity(request.user),
|
||||
software='bookwyrm')
|
||||
|
||||
# re-format the activity for non-bookwyrm servers
|
||||
remote_activity = status.to_create_activity(request.user, pure=True)
|
||||
broadcast(request.user, remote_activity, software='other')
|
||||
status.save(created=True)
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
|
||||
@ -108,7 +98,6 @@ class DeleteStatus(View):
|
||||
|
||||
# perform deletion
|
||||
delete_status(status)
|
||||
broadcast(request.user, status.to_delete_activity(request.user))
|
||||
return redirect(request.headers.get('Referer', '/'))
|
||||
|
||||
def find_mentions(content):
|
||||
|
@ -8,7 +8,6 @@ from django.views import View
|
||||
|
||||
from bookwyrm import models
|
||||
from bookwyrm.activitypub import ActivitypubResponse
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from .helpers import is_api_request
|
||||
|
||||
|
||||
@ -45,17 +44,15 @@ class AddTag(View):
|
||||
name = request.POST.get('name')
|
||||
book_id = request.POST.get('book')
|
||||
book = get_object_or_404(models.Edition, id=book_id)
|
||||
tag_obj, created = models.Tag.objects.get_or_create(
|
||||
tag_obj, _ = models.Tag.objects.get_or_create(
|
||||
name=name,
|
||||
)
|
||||
user_tag, _ = models.UserTag.objects.get_or_create(
|
||||
models.UserTag.objects.get_or_create(
|
||||
user=request.user,
|
||||
book=book,
|
||||
tag=tag_obj,
|
||||
)
|
||||
|
||||
if created:
|
||||
broadcast(request.user, user_tag.to_add_activity(request.user))
|
||||
return redirect('/book/%s' % book_id)
|
||||
|
||||
|
||||
@ -71,8 +68,6 @@ class RemoveTag(View):
|
||||
|
||||
user_tag = get_object_or_404(
|
||||
models.UserTag, tag=tag_obj, book=book, user=request.user)
|
||||
tag_activity = user_tag.to_remove_activity(request.user)
|
||||
user_tag.delete()
|
||||
|
||||
broadcast(request.user, tag_activity)
|
||||
return redirect('/book/%s' % book_id)
|
||||
|
@ -15,7 +15,6 @@ from django.views import View
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.activitypub import ActivitypubResponse
|
||||
from bookwyrm.broadcast import broadcast
|
||||
from bookwyrm.settings import PAGE_LENGTH
|
||||
from .helpers import get_activity_feed, get_user_from_username, is_api_request
|
||||
from .helpers import is_blocked, object_visible_to_user
|
||||
@ -176,7 +175,6 @@ class EditUser(View):
|
||||
user.avatar.save(filename, image)
|
||||
user.save()
|
||||
|
||||
broadcast(user, user.to_update_activity(user))
|
||||
return redirect(user.local_path)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user