Add notifications for membership changes.

This commit is contained in:
Oliver Marks 2018-05-09 07:00:47 +01:00
parent 673c194967
commit 9c19785a12
2 changed files with 12 additions and 2 deletions

View File

@ -7,7 +7,7 @@
Pop in and say hi, please wait around our users tend to idle, some one will likely respond given a chance. Pop in and say hi, please wait around our users tend to idle, some one will likely respond given a chance.
</p> </p>
<p> <p>
<a href="https://riot.im/app/#/room/#maidstone-hackspace:matrix.org">Full screen Chat</a> or grab one of the <a target="_blank" href="https://matrix.org/docs/projects/try-matrix-now.html">mobile apps. <a href="https://riot.im/app/#/room/#maidstone-hackspace:matrix.org">Full screen Chat</a> or grab one of the <a target="_blank" href="https://matrix.org/docs/projects/try-matrix-now.html">mobile apps for Android and Apple phones.</a>
</p> </p>
<iframe src="https://riot.im/app/#/room/#maidstone-hackspace:matrix.org" style="width:100%;height:600px;"></iframe> <iframe src="https://riot.im/app/#/room/#maidstone-hackspace:matrix.org" style="width:100%;height:600px;"></iframe>
@ -18,6 +18,5 @@
<p> <p>
Connect directly using irc.freenode.org and the #maidstone-hackspace channel via an irc client. Connect directly using irc.freenode.org and the #maidstone-hackspace channel via an irc client.
</p> </p>
<a href="https://hangouts.google.com/group/oDcAL0nDfQYfO3qq1">Alternatively join us on our legacy Hangouts chat</a>
{% endblock content %} {% endblock content %}

View File

@ -117,3 +117,14 @@ class Rfid(models.Model):
def name(self): def name(self):
return self.user.name return self.user.name
def send_subscription_update_message(sender, instance, **kwargs):
matrix_message.delay(
prefix=' - MEMBERSHIP',
message='Changed to %s for user %s' % (
instance.get_status,
instance.user.username))
post_save.connect(send_subscription_update_message, sender=Membership)