@@ -53,26 +53,30 @@ func set_user_name(user_name : String):
53
53
func load_user_posts (user_posts : Array ):
54
54
$ ScrollPost .hide ()
55
55
for post in post_container_box .get_children ():
56
- post .queue_free ()
57
- for post in user_posts :
58
- if not post .has ("document" ):
59
- continue
60
- var post_info : FirestoreDocument = FirestoreDocument .new (post .document )
61
- if PostsManager .has_post (post_info .doc_name ):
62
- if PostsManager .has_post_container (post_info .doc_name ):
63
- post_container_box .add_child (PostsManager .get_post_container_by_id (post_info .doc_name ).duplicate ())
56
+ if post is PostContainer : post .queue_free ()
57
+ if ( user_posts .size () == 1 and not user_posts [0 ].has ("document" ) ) or user_posts .empty ():
58
+ print (user_posts )
59
+ $ ScrollPost/PostContainer/Empty .show ()
60
+ else :
61
+ for post in user_posts :
62
+ if not post .has ("document" ):
63
+ continue
64
+ var post_info : FirestoreDocument = FirestoreDocument .new (post .document )
65
+ if PostsManager .has_post (post_info .doc_name ):
66
+ if PostsManager .has_post_container (post_info .doc_name ):
67
+ post_container_box .add_child (PostsManager .get_post_container_by_id (post_info .doc_name ).duplicate ())
68
+ else :
69
+ var post_container : PostContainer = Activities .post_container_scene .instance ()
70
+ post_container .load_post (PostsManager .add_post_from_doc (post_info .doc_name , post_info ))
71
+ post_container_box .add_child (post_container )
64
72
else :
73
+ var post_obj : PostsManager .Post = PostsManager .add_post_from_doc (
74
+ post_info .doc_name ,
75
+ post_info ,
76
+ Utilities .get_post_image (post_info .doc_fields .user_id , post_info .doc_name , post_info .doc_fields .image ))
65
77
var post_container : PostContainer = Activities .post_container_scene .instance ()
66
- post_container .load_post (PostsManager . add_post_from_doc ( post_info . doc_name , post_info ) )
78
+ post_container .load_post (post_obj )
67
79
post_container_box .add_child (post_container )
68
- else :
69
- var post_obj : PostsManager .Post = PostsManager .add_post_from_doc (
70
- post_info .doc_name ,
71
- post_info ,
72
- Utilities .get_post_image (post_info .doc_fields .user_id , post_info .doc_name , post_info .doc_fields .image ))
73
- var post_container : PostContainer = Activities .post_container_scene .instance ()
74
- post_container .load_post (post_obj )
75
- post_container_box .add_child (post_container )
76
80
$ ScrollPost .show ()
77
81
78
82
func _on_ConnecBtn_pressed ():
0 commit comments