fix comments

This commit is contained in:
RustamOper05 2024-01-17 16:17:22 +03:00
parent accc23b6b3
commit 259f1aa1e5

View file

@ -99,18 +99,31 @@ func GetComment(commentId string) Comment {
if comment == nil {
panic("comment not found")
}
return comment.(Comment)
return std.Deserialize(comment.([]byte)).(Comment)
}
func GetCommentInPost(commentId string, postId string) Comment {
comments := GetByPostId(postId)
comment_t := Comment{}
flag := 0
runtime.Log("SIZEEEEEE " + std.Itoa10(len(comments)))
for _, comment := range comments {
runtime.Log("COMMENT TOCHKA ID: " + comment.id + "--------COMMENT ID: " + commentId)
if comment.id == commentId {
return comment
runtime.Log("REEEEETTTTTTTUUUURNNNNNn")
comment_t = comment
flag = 1
}
runtime.Log("FALSE FALSE")
}
panic("comment not found")
runtime.Log("FLAAAAAAAAAAAAAAAAKKKK " + std.Itoa10(flag))
if flag == 0 {
panic("comment not found")
} else {
return comment_t
}
}
func RateComment(isLike bool, postId string, commentId string) {