Skip to content

Commit c8ab7a7

Browse files
committed
discourse: post a topic header for new releases that do not already have a thread
1 parent 7aaeba3 commit c8ab7a7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

appstore/discourse.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def _create_or_post_to_topic(app, is_generated, text):
5252

5353
App.query.filter_by(app_uuid=app.app_uuid).update({'discourse_topic_id': rv['topic_id']})
5454
db.session.commit()
55+
app.discourse_topic_id = rv['topic_id']
5556
else:
5657
_client.create_post(text, category_id=config['DISCOURSE_SHOWCASE_TOPIC_ID'], topic_id=app.discourse_topic_id)
5758

@@ -83,6 +84,9 @@ def screenshot_section(app):
8384
return output
8485

8586
def announce_release(app, release, is_generated):
87+
if app.discourse_topic_id == 0:
88+
announce_new_app(app, is_generated, is_new=False)
89+
8690
_create_or_post_to_topic(app, is_generated, text=f"""
8791
# {random_party_emoji()} Update alert!
8892
@@ -96,13 +100,13 @@ def announce_release(app, release, is_generated):
96100
97101
""")
98102

99-
def announce_new_app(app, is_generated):
103+
def announce_new_app(app, is_generated, is_new=True):
100104
_create_or_post_to_topic(app, is_generated, text=f"""
101105
{banner(app)}
102106
103107
# {app.title} by {app.developer.name}
104108
105-
:party: There's a new {app.type} on the Rebble App Store!
109+
:party: There's {"a new" if is_new else "another cool"} {app.type} on the Rebble App Store!
106110
107111
[quote=\"{app.developer.name} says\"]
108112
{get_app_description(app)}

0 commit comments

Comments
 (0)