def mk_tagged_alert(user, comment): alert_type = 'aremind.notifications.tagged_in_note.TaggedInNoteNotificationType' notif = Notification(alert_type=alert_type) notif.uid = 'tagged_%s_%s' % (comment.id, user.username) notif.text = 'You have been tagged in a note by <strong>%s</strong>.' % comment.author notif.url = reverse('%s_report_single' % comment.program, kwargs={'id': comment.report.id}) notif.data = json.dumps({'user_id': user.id}) return notif
def mk_response_alert(user, report, reply, mode): alert_type = 'aremind.notifications.communicator_response.CommunicatorResponseNotificationType' notif = Notification(alert_type=alert_type) notif.uid = 'commreply_%s_%s' % (reply.id, user.username) if mode == 'sender': notif.text = 'A beneficiary has replied to an inquiry you sent them about a report' elif mode == 'tagged': notif.text = 'A beneficiary has replied to an inquiry about a report you were tagged on' elif mode == 'commenter': notif.text = 'A beneficiary has replied to an inquiry on a report that you\'ve left comments on' notif.url = reverse('fadama_report_single', kwargs={'id': report.id}) notif.data = json.dumps({'user_id': user.id}) return notif