Backend: broadcast channel select (bot/site/both) / scheduled_broadcasts.channel migration v29 / API v1+v2 channel field. Frontend: global haptic on button click / navigator.vibrate fallback for non-tg.
This commit is contained in:
@@ -1337,6 +1337,16 @@ async def _migration_v24_add_identity_sessions(conn: AsyncConnection) -> None:
|
||||
)
|
||||
|
||||
|
||||
async def _migration_v29_add_scheduled_broadcasts_channel(conn: AsyncConnection) -> None:
|
||||
logger.info("[schema_upgrade] v29: scheduled_broadcasts.channel (bot/site/both)")
|
||||
if not await _table_exists(conn, "scheduled_broadcasts"):
|
||||
return
|
||||
if not await _column_exists(conn, "scheduled_broadcasts", "channel"):
|
||||
await conn.execute(
|
||||
text("ALTER TABLE scheduled_broadcasts ADD COLUMN channel VARCHAR(8) NOT NULL DEFAULT 'both'")
|
||||
)
|
||||
|
||||
|
||||
_MIGRATIONS = [
|
||||
(1, "Добавление users.id", _migration_v1_add_users_id),
|
||||
(2, "Добавление user_id колонок", _migration_v2_add_user_id_columns),
|
||||
@@ -1366,6 +1376,7 @@ _MIGRATIONS = [
|
||||
(26, "индексы keys(expiry_time/server_id/tariff_id)", _migration_v26_add_keys_indexes),
|
||||
(27, "admins.permissions (JSONB per-admin permissions)", _migration_v27_add_admins_permissions),
|
||||
(28, "таблица identity_notif_prefs (toggle каналов)", _migration_v28_add_identity_notif_prefs),
|
||||
(29, "scheduled_broadcasts.channel (bot/site/both)", _migration_v29_add_scheduled_broadcasts_channel),
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ class ScheduledBroadcast(DictLikeMixin, Base):
|
||||
created_by_tg_id = Column(BigInteger, ForeignKey("users.tg_id", ondelete="SET NULL"), nullable=True, index=True)
|
||||
status = Column(String(32), nullable=False, server_default=sql_text("'scheduled'"), index=True)
|
||||
send_to = Column(String(32), nullable=False, index=True)
|
||||
channel = Column(String(8), nullable=False, server_default=sql_text("'both'"))
|
||||
cluster_name = Column(String, nullable=True)
|
||||
text = Column(Text, nullable=False)
|
||||
photo = Column(String, nullable=True)
|
||||
|
||||
@@ -34,6 +34,7 @@ async def create_scheduled_broadcast(
|
||||
workers: int,
|
||||
messages_per_second: int,
|
||||
status: str = SCHEDULED_BROADCAST_STATUS_SCHEDULED,
|
||||
channel: str = "both",
|
||||
) -> ScheduledBroadcast:
|
||||
created_by_uid = None
|
||||
mirror_tg = created_by_tg_id
|
||||
@@ -46,6 +47,7 @@ async def create_scheduled_broadcast(
|
||||
created_by_user_id=created_by_uid,
|
||||
created_by_tg_id=mirror_tg,
|
||||
send_to=send_to,
|
||||
channel=channel,
|
||||
cluster_name=cluster_name,
|
||||
text=text,
|
||||
photo=photo,
|
||||
|
||||
Reference in New Issue
Block a user