mirror of
				https://git.sr.ht/~tsileo/microblog.pub
				synced 2025-06-05 21:59:23 +02:00 
			
		
		
		
	Fix Follow request handling
This commit is contained in:
		
							
								
								
									
										13
									
								
								app/boxes.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								app/boxes.py
									
									
									
									
									
								
							| @@ -1045,18 +1045,25 @@ async def _revert_side_effect_for_deleted_object( | |||||||
| async def _handle_follow_follow_activity( | async def _handle_follow_follow_activity( | ||||||
|     db_session: AsyncSession, |     db_session: AsyncSession, | ||||||
|     from_actor: models.Actor, |     from_actor: models.Actor, | ||||||
|     inbox_object: models.InboxObject, |     follow_activity: models.InboxObject, | ||||||
| ) -> None: | ) -> None: | ||||||
|  |     if follow_activity.activity_object_ap_id != LOCAL_ACTOR.ap_id: | ||||||
|  |         logger.warning( | ||||||
|  |             f"Dropping Follow activity for {follow_activity.activity_object_ap_id}" | ||||||
|  |         ) | ||||||
|  |         await db_session.delete(follow_activity) | ||||||
|  |         return | ||||||
|  |  | ||||||
|     if MANUALLY_APPROVES_FOLLOWERS: |     if MANUALLY_APPROVES_FOLLOWERS: | ||||||
|         notif = models.Notification( |         notif = models.Notification( | ||||||
|             notification_type=models.NotificationType.PENDING_INCOMING_FOLLOWER, |             notification_type=models.NotificationType.PENDING_INCOMING_FOLLOWER, | ||||||
|             actor_id=from_actor.id, |             actor_id=from_actor.id, | ||||||
|             inbox_object_id=inbox_object.id, |             inbox_object_id=follow_activity.id, | ||||||
|         ) |         ) | ||||||
|         db_session.add(notif) |         db_session.add(notif) | ||||||
|         return None |         return None | ||||||
|  |  | ||||||
|     await _send_accept(db_session, from_actor, inbox_object) |     await _send_accept(db_session, from_actor, follow_activity) | ||||||
|  |  | ||||||
|  |  | ||||||
| async def _get_incoming_follow_from_notification_id( | async def _get_incoming_follow_from_notification_id( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user