feat: add reply/forward/pin message flow across backend and web
Some checks failed
CI / test (push) Failing after 24s
Some checks failed
CI / test (push) Failing after 24s
- add reply_to/forwarded_from message fields and chat pinned_message field - add forward and pin APIs plus reply support in message create - wire web actions: Reply, Fwd, Pin and reply composer state - fix spam policy bug: allow repeated identical messages, keep rate limiting
This commit is contained in:
64
alembic/versions/0004_reply_forward_pin.py
Normal file
64
alembic/versions/0004_reply_forward_pin.py
Normal file
@@ -0,0 +1,64 @@
|
||||
"""reply forward pin
|
||||
|
||||
Revision ID: 0004_reply_forward_pin
|
||||
Revises: 0003_search_indexes
|
||||
Create Date: 2026-03-08 03:20:00.000000
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
||||
revision: str = "0004_reply_forward_pin"
|
||||
down_revision: Union[str, Sequence[str], None] = "0003_search_indexes"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column("messages", sa.Column("reply_to_message_id", sa.Integer(), nullable=True))
|
||||
op.add_column("messages", sa.Column("forwarded_from_message_id", sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(
|
||||
op.f("fk_messages_reply_to_message_id_messages"),
|
||||
"messages",
|
||||
"messages",
|
||||
["reply_to_message_id"],
|
||||
["id"],
|
||||
ondelete="SET NULL",
|
||||
)
|
||||
op.create_foreign_key(
|
||||
op.f("fk_messages_forwarded_from_message_id_messages"),
|
||||
"messages",
|
||||
"messages",
|
||||
["forwarded_from_message_id"],
|
||||
["id"],
|
||||
ondelete="SET NULL",
|
||||
)
|
||||
op.create_index(op.f("ix_messages_reply_to_message_id"), "messages", ["reply_to_message_id"], unique=False)
|
||||
op.create_index(op.f("ix_messages_forwarded_from_message_id"), "messages", ["forwarded_from_message_id"], unique=False)
|
||||
|
||||
op.add_column("chats", sa.Column("pinned_message_id", sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(
|
||||
op.f("fk_chats_pinned_message_id_messages"),
|
||||
"chats",
|
||||
"messages",
|
||||
["pinned_message_id"],
|
||||
["id"],
|
||||
ondelete="SET NULL",
|
||||
)
|
||||
op.create_index(op.f("ix_chats_pinned_message_id"), "chats", ["pinned_message_id"], unique=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(op.f("ix_chats_pinned_message_id"), table_name="chats")
|
||||
op.drop_constraint(op.f("fk_chats_pinned_message_id_messages"), "chats", type_="foreignkey")
|
||||
op.drop_column("chats", "pinned_message_id")
|
||||
|
||||
op.drop_index(op.f("ix_messages_forwarded_from_message_id"), table_name="messages")
|
||||
op.drop_index(op.f("ix_messages_reply_to_message_id"), table_name="messages")
|
||||
op.drop_constraint(op.f("fk_messages_forwarded_from_message_id_messages"), "messages", type_="foreignkey")
|
||||
op.drop_constraint(op.f("fk_messages_reply_to_message_id_messages"), "messages", type_="foreignkey")
|
||||
op.drop_column("messages", "forwarded_from_message_id")
|
||||
op.drop_column("messages", "reply_to_message_id")
|
||||
Reference in New Issue
Block a user