Mark incoming messages as read when sending outgoing message, replace $token
This commit is contained in:
parent
8e3726eba4
commit
639524b9a4
|
@ -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))
|
||||
|
||||
|
|
Loading…
Reference in New Issue