diff --git a/shiftregister/team/views.py b/shiftregister/team/views.py index 8ba4717..5407426 100644 --- a/shiftregister/team/views.py +++ b/shiftregister/team/views.py @@ -164,7 +164,14 @@ class HelperDetail(FormMixin, LoginRequiredMixin, DetailView): form = self.get_form() if form.is_valid(): - Message(text=form.cleaned_data["message"], to=self.object).save() + IncomingMessage.objects.filter(sender=self.object.phone).update(read=True) + Message( + text=form.cleaned_data["message"].replace( + "$token", + f"https://helfen.kntkt.de{self.object.logintoken_set.first().get_absolute_url()}", + ), + to=self.object, + ).save() return self.render_to_response(self.get_context_data(form=form))