mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +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();
|
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]
|
/// Delete a conversation specified by its [id]
|
||||||
|
@ -46,6 +46,17 @@ abstract class ModelDatabaseHelper<T extends CacheModel> {
|
|||||||
return null;
|
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
|
/// Get all the entries from the table
|
||||||
Future<List<T>> getAll() async {
|
Future<List<T>> getAll() async {
|
||||||
List<Map> maps = await (await DatabaseHelper.get()).query(tableName());
|
List<Map> maps = await (await DatabaseHelper.get()).query(tableName());
|
||||||
|
@ -143,13 +143,13 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
|
|||||||
Future<void> _submitForm() async {
|
Future<void> _submitForm() async {
|
||||||
final settings = Conversation(
|
final settings = Conversation(
|
||||||
id: isUpdating ? widget.initialSettings.id : 0,
|
id: isUpdating ? widget.initialSettings.id : 0,
|
||||||
|
ownerID: isUpdating ? widget.initialSettings.ownerID : 0,
|
||||||
name: _nameController.text,
|
name: _nameController.text,
|
||||||
following: _followConversation,
|
following: _followConversation,
|
||||||
members: _members.usersID,
|
members: _members.usersID,
|
||||||
|
|
||||||
// Give random value to these fields as they are ignored here
|
// Give random value to these fields as they are ignored here
|
||||||
lastActive: 0,
|
lastActive: 0,
|
||||||
ownerID: 0,
|
|
||||||
sawLastMessage: true);
|
sawLastMessage: true);
|
||||||
|
|
||||||
// Create the conversation
|
// Create the conversation
|
||||||
|
Loading…
Reference in New Issue
Block a user