Make follow-up posts be unlisted

This commit is contained in:
Liam Steckler 2024-01-13 15:00:05 -08:00
parent 1b1753ae52
commit 8f786b4dfa

12
scl.py
View file

@ -36,17 +36,13 @@ class SclOutage(Base):
__tablename__ = "scl_outages"
scl_outage_id: Mapped[int] = mapped_column(primary_key=True, unique=True)
outage_user_id: Mapped[str] = mapped_column()
most_recent_post_id: Mapped[str] = mapped_column()
most_recent_post_id: Mapped[Optional[str]] = mapped_column()
last_updated_time: Mapped[datetime] = mapped_column()
estimated_restoration_time: Mapped[datetime] = mapped_column()
cause: Mapped[str] = mapped_column()
outage_size: Mapped[str] = mapped_column()
status: Mapped[Optional[str]] = mapped_column()
no_longer_in_response_time: Mapped[
Optional[datetime]
] = (
mapped_column()
) # If the event is no longer being returned in the response, this will be set to the current time
no_longer_in_response_time: Mapped[Optional[datetime]] = mapped_column()
def __repr__(self) -> str:
return f"SclOutage(scl_outage_id={self.scl_outage_id!r}, most_recent_post_id={self.most_recent_post_id!r}, last_updated_time={self.last_updated_time!r}, no_longer_in_response_time={self.no_longer_in_response_time!r})"
@ -130,7 +126,7 @@ with Session(engine) as session:
mastodon_post_result = mastodon.status_post(
status="\n".join(updated_entries),
in_reply_to_id=existing_record.most_recent_post_id,
visibility="public",
visibility="unlisted",
)
existing_record.most_recent_post_id = mastodon_post_result["id"]
@ -183,7 +179,7 @@ Cause: {}
active_outage.outage_user_id
),
in_reply_to_id=active_outage.most_recent_post_id,
visibility="public",
visibility="unlisted",
)
active_outage.most_recent_post_id = mastodon_post_result["id"]