mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Handles new comments events
This commit is contained in:
@ -4,7 +4,6 @@ import 'package:comunic/enums/post_kind.dart';
|
||||
import 'package:comunic/enums/post_visibility_level.dart';
|
||||
import 'package:comunic/helpers/comments_helper.dart';
|
||||
import 'package:comunic/helpers/posts_helper.dart';
|
||||
import 'package:comunic/helpers/users_helper.dart';
|
||||
import 'package:comunic/lists/groups_list.dart';
|
||||
import 'package:comunic/lists/users_list.dart';
|
||||
import 'package:comunic/models/comment.dart';
|
||||
@ -493,22 +492,6 @@ class _PostTileState extends State<PostTile> {
|
||||
if (commentID < 1) throw new Exception("Comment ID is inferior to 1!");
|
||||
|
||||
clearCommentForm();
|
||||
|
||||
// Get and show new comment
|
||||
final newComment = await _commentsHelper.getSingle(commentID);
|
||||
|
||||
if (newComment == null)
|
||||
return showSimpleSnack(
|
||||
context, tr("Could not retrieve created comment!"));
|
||||
|
||||
// Get information about the user who created the comment (if required)
|
||||
if (!widget.usersInfo.hasUser(newComment.userID))
|
||||
widget.usersInfo
|
||||
.add(await UsersHelper().getSingleWithThrow(newComment.userID));
|
||||
|
||||
setState(() {
|
||||
widget.post.comments.add(newComment);
|
||||
});
|
||||
} catch (e) {
|
||||
print(e);
|
||||
showSimpleSnack(context, tr("Could not create comment!"));
|
||||
|
Reference in New Issue
Block a user