mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 22:39:22 +00:00
Fix issue on conversation update
This commit is contained in:
parent
0b1e579a41
commit
9d20c407fc
@ -58,7 +58,14 @@ class ConversationsHelper {
|
||||
|
||||
final response = await request.exec();
|
||||
|
||||
return response.code == 200;
|
||||
if(response.code != 200)
|
||||
return false;
|
||||
|
||||
//Delete old conversation entry from the database
|
||||
await _conversationsDatabaseHelper.delete(settings.id);
|
||||
|
||||
// Success
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Delete a conversation specified by its [id]
|
||||
|
@ -46,6 +46,17 @@ abstract class ModelDatabaseHelper<T extends CacheModel> {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Delete an entry from the database with a specified [id]
|
||||
///
|
||||
/// Return true if at least one entry was deleted / false else
|
||||
Future<bool> delete(int id) async {
|
||||
return await (await DatabaseHelper.get()).delete(
|
||||
tableName(),
|
||||
where: '${BaseTableContract.C_ID} = ?',
|
||||
whereArgs: [id],
|
||||
) > 0;
|
||||
}
|
||||
|
||||
/// Get all the entries from the table
|
||||
Future<List<T>> getAll() async {
|
||||
List<Map> maps = await (await DatabaseHelper.get()).query(tableName());
|
||||
|
@ -143,13 +143,13 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
|
||||
Future<void> _submitForm() async {
|
||||
final settings = Conversation(
|
||||
id: isUpdating ? widget.initialSettings.id : 0,
|
||||
ownerID: isUpdating ? widget.initialSettings.ownerID : 0,
|
||||
name: _nameController.text,
|
||||
following: _followConversation,
|
||||
members: _members.usersID,
|
||||
|
||||
// Give random value to these fields as they are ignored here
|
||||
lastActive: 0,
|
||||
ownerID: 0,
|
||||
sawLastMessage: true);
|
||||
|
||||
// Create the conversation
|
||||
|
Loading…
Reference in New Issue
Block a user