feat: переименование доменной области
This commit is contained in:
@@ -22,16 +22,23 @@ async def handle_subscription(
|
||||
log.warning('Placement not found for invite_link: %s', invite_link)
|
||||
return
|
||||
|
||||
subscriber = domain.Subscriber(
|
||||
telegram_id=user_telegram_id,
|
||||
username=username,
|
||||
first_name=first_name,
|
||||
last_name=last_name,
|
||||
)
|
||||
await self.database.upsert_subscriber(subscriber)
|
||||
subscriber = await self.database.get_user(telegram_id=user_telegram_id)
|
||||
if not subscriber:
|
||||
subscriber = domain.User(
|
||||
telegram_id=user_telegram_id,
|
||||
username=username,
|
||||
first_name=first_name,
|
||||
last_name=last_name,
|
||||
)
|
||||
await self.database.create_user(subscriber)
|
||||
else:
|
||||
subscriber.username = username or subscriber.username
|
||||
subscriber.first_name = first_name or subscriber.first_name
|
||||
subscriber.last_name = last_name or subscriber.last_name
|
||||
await self.database.update_user(subscriber)
|
||||
|
||||
active_subscription = await self.database.get_active_subscription_by_subscriber_and_channel(
|
||||
subscriber.id, placement.target_channel.telegram_id
|
||||
active_subscription = await self.database.get_active_subscription_by_subscriber_and_project(
|
||||
subscriber.id, placement.project_id
|
||||
)
|
||||
|
||||
if active_subscription:
|
||||
@@ -43,7 +50,7 @@ async def handle_subscription(
|
||||
'ignoring new subscription attempt via placement %s',
|
||||
subscriber.id,
|
||||
user_telegram_id,
|
||||
placement.target_channel_id,
|
||||
placement.project_id,
|
||||
active_subscription.placement_id,
|
||||
placement.id,
|
||||
)
|
||||
@@ -72,7 +79,6 @@ async def handle_subscription(
|
||||
subscription = domain.Subscription(
|
||||
placement_id=placement.id,
|
||||
subscriber_id=subscriber.id,
|
||||
target_channel_id=placement.target_channel_id,
|
||||
invite_link=invite_link,
|
||||
)
|
||||
async with self.database.transaction():
|
||||
|
||||
Reference in New Issue
Block a user