Show per-app actor in follow notifications on Hub
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m34s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m34s
Add app_domain to APNotification model and NotificationDTO so follow notifications display "followed you on blog" instead of just "followed you" when the follow targets a per-app actor. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
{% if notif.notification_type == "follow" %}
|
{% if notif.notification_type == "follow" %}
|
||||||
<span class="text-stone-600">followed you</span>
|
<span class="text-stone-600">followed you{% if notif.app_domain and notif.app_domain != "federation" %} on {{ notif.app_domain }}{% endif %}</span>
|
||||||
{% elif notif.notification_type == "like" %}
|
{% elif notif.notification_type == "like" %}
|
||||||
<span class="text-stone-600">liked your post</span>
|
<span class="text-stone-600">liked your post</span>
|
||||||
{% elif notif.notification_type == "boost" %}
|
{% elif notif.notification_type == "boost" %}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
"""Add app_domain to ap_notifications.
|
||||||
|
|
||||||
|
Revision ID: w3u1q9r0s1
|
||||||
|
Revises: v2t0p8q9r0
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
revision = "w3u1q9r0s1"
|
||||||
|
down_revision = "v2t0p8q9r0"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.add_column(
|
||||||
|
"ap_notifications",
|
||||||
|
sa.Column("app_domain", sa.String(30), nullable=True),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.drop_column("ap_notifications", "app_domain")
|
||||||
@@ -316,3 +316,4 @@ class NotificationDTO:
|
|||||||
from_actor_domain: str | None = None
|
from_actor_domain: str | None = None
|
||||||
from_actor_icon: str | None = None
|
from_actor_icon: str | None = None
|
||||||
target_content_preview: str | None = None
|
target_content_preview: str | None = None
|
||||||
|
app_domain: str | None = None
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ async def handle_follow(
|
|||||||
actor_profile_id=actor_row.id,
|
actor_profile_id=actor_row.id,
|
||||||
notification_type="follow",
|
notification_type="follow",
|
||||||
from_remote_actor_id=ra.id,
|
from_remote_actor_id=ra.id,
|
||||||
|
app_domain=app_domain,
|
||||||
)
|
)
|
||||||
session.add(notif)
|
session.add(notif)
|
||||||
|
|
||||||
|
|||||||
@@ -422,6 +422,7 @@ class APNotification(Base):
|
|||||||
target_remote_post_id: Mapped[int | None] = mapped_column(
|
target_remote_post_id: Mapped[int | None] = mapped_column(
|
||||||
Integer, ForeignKey("ap_remote_posts.id", ondelete="SET NULL"), nullable=True,
|
Integer, ForeignKey("ap_remote_posts.id", ondelete="SET NULL"), nullable=True,
|
||||||
)
|
)
|
||||||
|
app_domain: Mapped[str | None] = mapped_column(String(30), nullable=True)
|
||||||
read: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False, server_default="false")
|
read: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False, server_default="false")
|
||||||
created_at: Mapped[datetime] = mapped_column(
|
created_at: Mapped[datetime] = mapped_column(
|
||||||
DateTime(timezone=True), nullable=False, server_default=func.now(),
|
DateTime(timezone=True), nullable=False, server_default=func.now(),
|
||||||
|
|||||||
@@ -1620,6 +1620,7 @@ class SqlFederationService:
|
|||||||
target_content_preview=preview,
|
target_content_preview=preview,
|
||||||
created_at=notif.created_at,
|
created_at=notif.created_at,
|
||||||
read=notif.read,
|
read=notif.read,
|
||||||
|
app_domain=notif.app_domain,
|
||||||
))
|
))
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user