⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion backend/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,20 @@ def send_bloom():
type_check_error = verify_request_fields({"content": str})
if type_check_error is not None:
return type_check_error

content = request.json["content"]

if len(content) > 280:
return jsonify(
{
"success": False,
"message": "Bloom content too long (max 280 characters)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the max character count changed, you'd need to update two places in code at the moment - can you think how to reduce that to one?

}
), 400

user = get_current_user()

blooms.add_bloom(sender=user, content=request.json["content"])
blooms.add_bloom(sender=user, content=content)

return jsonify(
{
Expand Down