Skip to content

Commit eba0333

Browse files
committed
fix(services): rename publish flow for platform content
1 parent 8e7bcf7 commit eba0333

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

rest_services/v1/routes.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,22 @@
2020
PublishContentResponse,
2121
ServerStaticPublicKey,
2222
)
23-
from rest_services.v1.services import publish_content, store_segment_and_try_join
23+
from rest_services.v1.services import (
24+
publish_platform_content,
25+
store_segment_and_try_join,
26+
)
2427

2528
logger = get_logger(__name__)
2629

2730
router = APIRouter()
2831

2932
ALLOWED_PLATFORM_MANIFEST_KEYS = [
33+
"display_name",
3034
"name",
31-
"shortcode",
3235
"proto_id",
3336
"cat_id",
3437
"icon_svg",
3538
"icon_png",
36-
"support_url_scheme",
3739
]
3840
ALLOWED_PLATFORMS_WITH_CLIENT_METADATA = ["bluesky"]
3941

@@ -195,7 +197,7 @@ def create_publications(
195197
)
196198

197199
with get_session() as db:
198-
publish_content(
200+
publish_platform_content(
199201
token_id=t_id,
200202
key_id=payload.get_kid(),
201203
len_att=payload.get_len_att(),
@@ -228,7 +230,7 @@ def create_publications(
228230
status_code=400, detail="Payload is missing token ID"
229231
)
230232

231-
publish_content(
233+
publish_platform_content(
232234
token_id=t_id,
233235
key_id=joined.get_kid(),
234236
len_att=joined.get_len_att(),

rest_services/v1/services.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ def _get_adapter_params(
4141

4242
match cat_id:
4343
case rrs.V1ContentCategories.EMAIL:
44+
to = content.get_to().decode()
4445
return {
4546
"from_email": token_data["account_id"],
46-
"to_email": content.get_to().decode(),
47+
"to_email": to,
48+
"recipient": to,
4749
"subject": content.get_subject().decode(),
4850
"message": content.get_body().decode(),
49-
"recipient": content.get_to().decode(),
5051
**extra_params,
5152
}
5253
case rrs.V1ContentCategories.MESSAGE:
@@ -78,7 +79,7 @@ def _consume_used_keys(token_hash: TokenHash, key_index: int, session: Session)
7879
mark_ss_kid_used(key_index, session)
7980

8081

81-
def publish_content(
82+
def publish_platform_content(
8283
token_id: int,
8384
key_id: int,
8485
len_att: int,
@@ -146,8 +147,8 @@ def publish_content(
146147
},
147148
)
148149
case _:
149-
logger.error("unsupported protocol: %r", token.protocol)
150-
raise ValueError(f"unsupported protocol: {token.protocol!r}")
150+
logger.error("unsupported protocol: %r", proto_id)
151+
raise ValueError(f"unsupported protocol: {proto_id!r}")
151152

152153
pipe = AdapterIPCHandler.invoke(
153154
adapter_path=adapter.path,

0 commit comments

Comments
 (0)