From 7d0a5aeeefde23f588588a4414bfe6b29271e2ec Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 18 Oct 2024 16:50:13 +0100 Subject: Don't need to send both text and html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit now that the other end can use html Change-Id: Idb7959b041ebbbd9284007594473019cf603981f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175166 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice (cherry picked from commit 9ed5dd5d1b48b9a17967d85c0fad4994c40caafa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175998 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- desktop/qa/desktop_lib/test_desktop_lib.cxx | 18 +++++++++--------- sw/qa/extras/uiwriter/uiwriter6.cxx | 4 ++-- sw/qa/extras/uiwriter/uiwriter8.cxx | 4 ++-- sw/source/uibase/docvw/PostItMgr.cxx | 2 +- sw/source/uibase/uno/unotxdoc.cxx | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 1594e2fd6e00..fa36de31ff73 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2389,20 +2389,20 @@ void DesktopLOKTest::testCommentsWriter() { CPPUNIT_ASSERT(rComment.second.get("id") > 0); CPPUNIT_ASSERT(!rComment.second.get("author").empty()); - CPPUNIT_ASSERT(!rComment.second.get("text").empty()); + CPPUNIT_ASSERT(!rComment.second.get("html").empty()); // Has a valid iso 8601 date time string css::util::DateTime aDateTime; OUString aDateTimeString = OUString::createFromAscii(rComment.second.get("dateTime")); CPPUNIT_ASSERT(utl::ISO8601parseDateTime(aDateTimeString, aDateTime)); // This comment has a marked text range - if (rComment.second.get("text") == "Comment 2") + if (rComment.second.get("html") == "
Comment 2
") { CPPUNIT_ASSERT(!rComment.second.get("textRange").empty()); nComment2Id = rComment.second.get("id"); } // This is a reply comment - else if (rComment.second.get("text") == "Reply to Comment 2") + else if (rComment.second.get("html") == "
Reply to Comment 2
") { CPPUNIT_ASSERT_EQUAL(nComment2Id, rComment.second.get("parentId")); } @@ -2548,8 +2548,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter() CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView2.m_aCommentCallbackResult.get("action")); CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get("parentId")); CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get("parentId")); - CPPUNIT_ASSERT_EQUAL(std::string("Reply comment"), aView1.m_aCommentCallbackResult.get("text")); - CPPUNIT_ASSERT_EQUAL(std::string("Reply comment"), aView2.m_aCommentCallbackResult.get("text")); + CPPUNIT_ASSERT_EQUAL(std::string("
Reply comment
"), aView1.m_aCommentCallbackResult.get("html")); + CPPUNIT_ASSERT_EQUAL(std::string("
Reply comment
"), aView2.m_aCommentCallbackResult.get("html")); int nCommentId2 = aView1.m_aCommentCallbackResult.get("id"); // Edit the previously added comment @@ -2563,8 +2563,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter() // parent is unchanged still CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get("parentId")); CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get("parentId")); - CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView1.m_aCommentCallbackResult.get("text")); - CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView2.m_aCommentCallbackResult.get("text")); + CPPUNIT_ASSERT_EQUAL(std::string("
Edited comment
"), aView1.m_aCommentCallbackResult.get("html")); + CPPUNIT_ASSERT_EQUAL(std::string("
Edited comment
"), aView2.m_aCommentCallbackResult.get("html")); // Delete the reply comment just added aCommandArgs = "{ \"Id\": { \"type\": \"string\", \"value\": \"" + OString::number(nCommentId2) + "\" } }"; @@ -2587,8 +2587,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter() CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView2.m_aCommentCallbackResult.get("action")); CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get("parentId")); CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get("parentId")); - CPPUNIT_ASSERT_EQUAL(std::string("Reply comment again"), aView1.m_aCommentCallbackResult.get("text")); - CPPUNIT_ASSERT_EQUAL(std::string("Reply comment again"), aView2.m_aCommentCallbackResult.get("text")); + CPPUNIT_ASSERT_EQUAL(std::string("
Reply comment again
"), aView1.m_aCommentCallbackResult.get("html")); + CPPUNIT_ASSERT_EQUAL(std::string("
Reply comment again
"), aView2.m_aCommentCallbackResult.get("html")); // .uno:ViewAnnotations returns total of 5 comments boost::property_tree::ptree aTree; diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index 7d5bc22b8fa6..af5c132f880a 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -2696,10 +2696,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535) for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("comments")) { const boost::property_tree::ptree& rComment = rValue.second; - sCommentText = OString(rComment.get("text")); + sCommentText = OString(rComment.get("html")); } // This was false (lost comment with spelling replacement) - CPPUNIT_ASSERT_EQUAL("with comment"_ostr, sCommentText); + CPPUNIT_ASSERT_EQUAL("
with comment
"_ostr, sCommentText); } #endif diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 1c09ab6a9ad6..92ef307ba1d8 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -2016,8 +2016,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf132603) { const boost::property_tree::ptree& rComment = rValue.second; - OString aText(rComment.get("text")); - CPPUNIT_ASSERT_EQUAL("Comment"_ostr, aText); + OString aText(rComment.get("html")); + CPPUNIT_ASSERT_EQUAL("
Comment
"_ostr, aText); } } diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index bf1b56082fba..177d52c9777b 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -175,7 +175,7 @@ namespace { aAnnotation.put("id", pField->GetPostItId()); aAnnotation.put("parentId", pField->GetParentPostItId()); aAnnotation.put("author", pField->GetPar1().toUtf8().getStr()); - aAnnotation.put("text", pField->GetPar2().toUtf8().getStr()); + // Note, for just plain text we could use "text" populated by pField->GetPar2() aAnnotation.put("html", pWin->GetSimpleHtml()); aAnnotation.put("resolved", pField->GetResolved() ? "true" : "false"); aAnnotation.put("dateTime", utl::toISO8601(pField->GetDateTime().GetUNODateTime())); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index e1d9aea18593..794c88a463cd 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3494,7 +3494,7 @@ void SwXTextDocument::getPostIts(tools::JsonWriter& rJsonWriter) rJsonWriter.put("id", pField->GetPostItId()); rJsonWriter.put("parentId", pField->GetParentPostItId()); rJsonWriter.put("author", pField->GetPar1()); - rJsonWriter.put("text", pField->GetPar2()); + // Note, for just plain text we could use "text" populated by pField->GetPar2() rJsonWriter.put("html", pWin->GetSimpleHtml()); rJsonWriter.put("resolved", pField->GetResolved() ? "true" : "false"); rJsonWriter.put("dateTime", utl::toISO8601(pField->GetDateTime().GetUNODateTime())); -- cgit v1.2.3