diff --git a/bookwyrm/models/__init__.py b/bookwyrm/models/__init__.py index 9edb89286..c455c751f 100644 --- a/bookwyrm/models/__init__.py +++ b/bookwyrm/models/__init__.py @@ -27,7 +27,7 @@ from .group import Group, GroupMember, GroupMemberInvitation from .import_job import ImportJob, ImportItem -from .move import MoveUser, MoveUserNotification +from .move import MoveUser from .site import SiteSettings, Theme, SiteInvite from .site import PasswordReset, InviteRequest diff --git a/bookwyrm/models/move.py b/bookwyrm/models/move.py index ef7cad372..a5bf9d76d 100644 --- a/bookwyrm/models/move.py +++ b/bookwyrm/models/move.py @@ -6,6 +6,7 @@ from bookwyrm import activitypub from .activitypub_mixin import ActivityMixin from .base_model import BookWyrmModel from . import fields +from .notification import Notification class Move(ActivityMixin, BookWyrmModel): @@ -63,25 +64,9 @@ class MoveUser(Move): for follower in self.user.followers.all(): if follower.local: - MoveUserNotification.objects.create(user=follower, target=self.user) + Notification.notify( + follower, self.user, notification_type=Notification.MOVE + ) else: raise PermissionDenied() - - -class MoveUserNotification(models.Model): - """notify followers that the user has moved""" - - created_date = models.DateTimeField(auto_now_add=True) - - user = models.ForeignKey( - "User", on_delete=models.PROTECT, related_name="moved_user_notifications" - ) # user we are notifying - - target = models.ForeignKey( - "User", on_delete=models.PROTECT, related_name="moved_user_notification_target" - ) # new account of user who moved - - def save(self, *args, **kwargs): - """send notification""" - super().save(*args, **kwargs) diff --git a/bookwyrm/models/notification.py b/bookwyrm/models/notification.py index 9026b23df..093c25c65 100644 --- a/bookwyrm/models/notification.py +++ b/bookwyrm/models/notification.py @@ -2,14 +2,7 @@ from django.db import models, transaction from django.dispatch import receiver from .base_model import BookWyrmModel -from . import ( - Boost, - Favorite, - GroupMemberInvitation, - ImportJob, - LinkDomain, - MoveUserNotification, -) +from . import Boost, Favorite, GroupMemberInvitation, ImportJob, LinkDomain from . import ListItem, Report, Status, User, UserFollowRequest @@ -336,12 +329,3 @@ def notify_user_on_follow(sender, instance, created, *args, **kwargs): notification_type=Notification.FOLLOW, read=False, ) - - -@receiver(models.signals.post_save, sender=MoveUserNotification) -# pylint: disable=unused-argument -def notify_on_move(sender, instance, *args, **kwargs): - """someone migrated their account""" - Notification.notify( - instance.user, instance.target, notification_type=Notification.MOVE - ) diff --git a/bookwyrm/templates/feed/layout.html b/bookwyrm/templates/feed/layout.html index 3a17e3e0b..1a2fb33c6 100644 --- a/bookwyrm/templates/feed/layout.html +++ b/bookwyrm/templates/feed/layout.html @@ -5,22 +5,6 @@ {% block title %}{% trans "Updates" %}{% endblock %} {% block content %} -{% if user.moved_to %} -
- {% trans "You have have moved to" %} - {% id_to_username user.moved_to %} -
-{% trans "You can undo this move to restore full functionality, but some followers may have already unfollowed this account." %}
- -