mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-29 16:07:52 +00:00
fix: closed group creation sets thread date to formation timestamp
This commit is contained in:
@@ -595,6 +595,7 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
||||
PushNotificationAPI.performOperation(PushNotificationAPI.ClosedGroupOperation.Subscribe, group.sessionId, localUserPublicKey)
|
||||
// Notify the user
|
||||
val threadID = getOrCreateThreadIdFor(Address.fromSerialized(groupId))
|
||||
threadDb.setDate(threadID, formationTimestamp)
|
||||
insertOutgoingInfoMessage(context, groupId, SignalServiceGroup.Type.CREATION, title, members.map { it.serialize() }, admins.map { it.serialize() }, threadID, formationTimestamp)
|
||||
// Don't create config group here, it's from a config update
|
||||
// Start polling
|
||||
@@ -1278,6 +1279,11 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
||||
return threadDB.isPinned(threadID)
|
||||
}
|
||||
|
||||
override fun setThreadDate(threadId: Long, newDate: Long) {
|
||||
val threadDb = DatabaseComponent.get(context).threadDatabase()
|
||||
threadDb.setDate(threadId, newDate)
|
||||
}
|
||||
|
||||
override fun deleteConversation(threadID: Long) {
|
||||
val recipient = getRecipientForThread(threadID)
|
||||
val threadDB = DatabaseComponent.get(context).threadDatabase()
|
||||
|
||||
@@ -366,6 +366,14 @@ public class ThreadDatabase extends Database {
|
||||
notifyConversationListListeners();
|
||||
}
|
||||
|
||||
public void setDate(long threadId, long date) {
|
||||
ContentValues contentValues = new ContentValues(1);
|
||||
contentValues.put(DATE, date);
|
||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||
int updated = db.update(TABLE_NAME, contentValues, ID_WHERE, new String[] {threadId+""});
|
||||
if (updated > 0) notifyConversationListListeners();
|
||||
}
|
||||
|
||||
public int getDistributionType(long threadId) {
|
||||
SQLiteDatabase db = databaseHelper.getReadableDatabase();
|
||||
Cursor cursor = db.query(TABLE_NAME, new String[]{TYPE}, ID_WHERE, new String[]{String.valueOf(threadId)}, null, null, null);
|
||||
|
||||
Reference in New Issue
Block a user