From 78d30cc71a07c59ea929796775e0a63c6a4a081a Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 10 Apr 2017 10:17:24 -0500
Subject: [PATCH] thread: Fix crash editing thread entry with inline image

This fixes an InconsistentModelException error when editing thread
entries with inline images. The fix assumes that inline images are
re-attached when a new ThreadEntry is created and the body is copied
from the previous entry. Only the non-inline attachments need to be
moved in the update query.
---
 include/class.thread_actions.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/class.thread_actions.php b/include/class.thread_actions.php
index 6650ee098..d2933d4b7 100644
--- a/include/class.thread_actions.php
+++ b/include/class.thread_actions.php
@@ -165,7 +165,9 @@ JS
         }
 
         // Move the attachments to the new entry
-        $old->attachments->update(array(
+        $old->attachments->filter(array(
+            'inline' => false,
+        ))->update(array(
             'object_id' => $entry->id
         ));
 
-- 
GitLab