Remove transaction in comment

This commit is contained in:
cuom1999 2023-12-22 23:01:45 -06:00
parent f970d11d67
commit dd32982687

View file

@ -4,7 +4,7 @@ from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from django.contrib.auth.context_processors import PermWrapper from django.contrib.auth.context_processors import PermWrapper
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.db import IntegrityError, transaction from django.db import IntegrityError
from django.db.models import Q, F, Count, FilteredRelation from django.db.models import Q, F, Count, FilteredRelation
from django.db.models.functions import Coalesce from django.db.models.functions import Coalesce
from django.db.models.expressions import F, Value from django.db.models.expressions import F, Value
@ -242,7 +242,7 @@ class CommentEditAjax(LoginRequiredMixin, CommentMixin, UpdateView):
add_mention_notifications(comment) add_mention_notifications(comment)
comment.revision_count = comment.versions.count() + 1 comment.revision_count = comment.versions.count() + 1
comment.save(update_fields=["revision_count"]) comment.save(update_fields=["revision_count"])
with transaction.atomic(), revisions.create_revision(): with revisions.create_revision():
revisions.set_comment(_("Edited from site")) revisions.set_comment(_("Edited from site"))
revisions.set_user(self.request.user) revisions.set_user(self.request.user)
return super(CommentEditAjax, self).form_valid(form) return super(CommentEditAjax, self).form_valid(form)