base menu, about page, atom feed
This commit is contained in:
parent
013ca30765
commit
0b64fd58a1
21 changed files with 284 additions and 47 deletions
|
|
@ -12,7 +12,7 @@ from ..celery import app
|
|||
from . import models
|
||||
|
||||
|
||||
@app.task(queue="default")
|
||||
@app.task(queue="default", ignore_results=True)
|
||||
def announce_items():
|
||||
if not getattr(settings, 'SIGNAL_ANNOUNCE_GROUP'):
|
||||
return
|
||||
|
|
@ -42,18 +42,27 @@ def announce_items():
|
|||
os.unlink(f.name)
|
||||
|
||||
|
||||
@app.task(queue="default")
|
||||
@app.task(queue="default", ignore_results=True)
|
||||
def notify_moderators(id, link):
|
||||
comment = models.Comment.objects.filter(id=id).first()
|
||||
if comment:
|
||||
message = "%s commented on %s (%s)\n\n%s" % (comment.name, comment.item.title, link, comment.text)
|
||||
message = "%s commented on %s (%s)\n\n%s" % (
|
||||
comment.name, comment.item.title, link, comment.text
|
||||
)
|
||||
r = rpc.send(message, group=settings.SIGNAL_MODERATORS_GROUP)
|
||||
if r and "timestamp" in r:
|
||||
comment.data["moderator_ts"] = r["timestamp"]
|
||||
comment.save()
|
||||
if comment.published:
|
||||
account = settings.SIGNAL_ACCOUNT
|
||||
group = settings.SIGNAL_MODERATORS_GROUP
|
||||
rpc.send_reaction(
|
||||
account, comment.data["moderator_ts"], "🎉", group=group
|
||||
)
|
||||
else:
|
||||
print("failed to notify", r)
|
||||
|
||||
|
||||
@app.on_after_finalize.connect
|
||||
def setup_periodic_tasks(sender, **kwargs):
|
||||
sender.add_periodic_task(crontab(minute="*/2"), announce_items.s())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue