Add a blacklist editor that saves to e621
The Online sidebar's "Your blacklist" section is editable now: typing a
tag appends it and each entry gets an x to remove it. Changes are written
straight to the e621 account (PATCH /users/{id}.json with
user[blacklisted_tags]); the store keeps the fetched profile for the id,
updates the list optimistically and reloads it from e621. The Followed
page's blacklist cloud is rebuilt afterwards via the new
/api/follows/cloud/?refresh=1 force flag.
Verified against the live API with a reversible add/verify/restore test.
This commit is contained in:
@@ -282,10 +282,13 @@ class FollowCloudView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
def get(self, request):
|
||||
force = request.query_params.get("refresh") == "1"
|
||||
cloud, _ = FollowCloud.objects.get_or_create(user=request.user)
|
||||
now = timezone.now()
|
||||
stale = cloud.computed_at is None or now - cloud.computed_at > (
|
||||
cloud_service.CLOUD_TTL
|
||||
stale = (
|
||||
force
|
||||
or cloud.computed_at is None
|
||||
or now - cloud.computed_at > (cloud_service.CLOUD_TTL)
|
||||
)
|
||||
if stale:
|
||||
reclaim = Q(building=False) | Q(
|
||||
|
||||
Reference in New Issue
Block a user