From f5724795cf1ced0360a02338c25491629527a3eb Mon Sep 17 00:00:00 2001 From: Rhodey Orbits Date: Mon, 6 Apr 2015 13:44:18 -0700 Subject: [PATCH] Update thread timestamp on draft creation. Fixes #1055 Closes #2909 // FREEBIE --- src/org/thoughtcrime/securesms/ConversationActivity.java | 2 +- src/org/thoughtcrime/securesms/database/ThreadDatabase.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 90be95a168..733519f659 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -895,7 +895,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity if (threadId == -1) threadId = threadDatabase.getThreadIdFor(getRecipients(), thisDistributionType); draftDatabase.insertDrafts(new MasterCipher(thisMasterSecret), threadId, drafts); - threadDatabase.updateSnippet(threadId, drafts.getSnippet(ConversationActivity.this), Types.BASE_DRAFT_TYPE); + threadDatabase.updateSnippet(threadId, drafts.getSnippet(ConversationActivity.this), System.currentTimeMillis(), Types.BASE_DRAFT_TYPE); } else if (threadId > 0) { threadDatabase.update(threadId); } diff --git a/src/org/thoughtcrime/securesms/database/ThreadDatabase.java b/src/org/thoughtcrime/securesms/database/ThreadDatabase.java index 7ef28452e8..94eab7a5a8 100644 --- a/src/org/thoughtcrime/securesms/database/ThreadDatabase.java +++ b/src/org/thoughtcrime/securesms/database/ThreadDatabase.java @@ -130,8 +130,10 @@ public class ThreadDatabase extends Database { notifyConversationListListeners(); } - public void updateSnippet(long threadId, String snippet, long type) { + public void updateSnippet(long threadId, String snippet, long date, long type) { ContentValues contentValues = new ContentValues(3); + + contentValues.put(DATE, date - date % 1000); contentValues.put(SNIPPET, snippet); contentValues.put(SNIPPET_TYPE, type); SQLiteDatabase db = databaseHelper.getWritableDatabase();