Skip to content

Commit

Permalink
Merge "Fix status message in contact updates."
Browse files Browse the repository at this point in the history
  • Loading branch information
flerda authored and Android (Google) Code Review committed Sep 7, 2011
2 parents 43e5c84 + 4747809 commit d2ee150
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
8 changes: 1 addition & 7 deletions src/com/android/providers/contacts/ContactsProvider2.java
Expand Up @@ -145,8 +145,6 @@
import android.provider.SyncStateContract;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.Html;
import android.text.SpannableString;
import android.text.TextUtils;
import android.util.Log;

Expand Down Expand Up @@ -3331,11 +3329,7 @@ public long insertStatusUpdate(ContentValues values) {

/** Converts a status update to HTML. */
private String statusUpdateToHtml(String status) {
String html = Html.toHtml(new SpannableString(status));
if (html.endsWith("\n")) {
html = html.substring(0, html.length() - 1);
}
return html;
return TextUtils.htmlEncode(status);
}

private String getResourceName(Resources resources, String expectedType, Integer resourceId) {
Expand Down
Expand Up @@ -3759,7 +3759,7 @@ public void testStreamItemInsertedOnStatusUpdate() {

ContentValues expectedValues = new ContentValues();
expectedValues.put(StreamItems.RAW_CONTACT_ID, rawContactId);
expectedValues.put(StreamItems.TEXT, "<p>hacking</p>");
expectedValues.put(StreamItems.TEXT, "hacking");
assertStoredValues(RawContacts.CONTENT_URI.buildUpon()
.appendPath(String.valueOf(rawContactId))
.appendPath(RawContacts.StreamItems.CONTENT_DIRECTORY).build(),
Expand All @@ -3781,7 +3781,7 @@ public void testStreamItemInsertedOnStatusUpdate_HtmlQuoting() {

ContentValues expectedValues = new ContentValues();
expectedValues.put(StreamItems.RAW_CONTACT_ID, rawContactId);
expectedValues.put(StreamItems.TEXT, "<p>&amp; &lt;b&gt; test &amp;#39;</p>");
expectedValues.put(StreamItems.TEXT, "&amp; &lt;b&gt; test &amp;#39;");
assertStoredValues(RawContacts.CONTENT_URI.buildUpon()
.appendPath(String.valueOf(rawContactId))
.appendPath(RawContacts.StreamItems.CONTENT_DIRECTORY).build(),
Expand All @@ -3804,7 +3804,7 @@ public void testStreamItemUpdatedOnSecondStatusUpdate() {

ContentValues expectedValues = new ContentValues();
expectedValues.put(StreamItems.RAW_CONTACT_ID, rawContactId);
expectedValues.put(StreamItems.TEXT, "<p>finished hacking</p>");
expectedValues.put(StreamItems.TEXT, "finished hacking");
assertStoredValues(RawContacts.CONTENT_URI.buildUpon()
.appendPath(String.valueOf(rawContactId))
.appendPath(RawContacts.StreamItems.CONTENT_DIRECTORY).build(),
Expand Down

0 comments on commit d2ee150

Please sign in to comment.