2023-06-23 03:32:51 +01:00
|
|
|
new_comment = function(parent_id, depth)
|
2023-07-16 21:45:30 +01:00
|
|
|
local id = new_comment_id(parent_id)
|
2023-06-23 07:43:03 +01:00
|
|
|
print('creating', id)
|
2023-06-23 03:32:51 +01:00
|
|
|
local comment = {
|
|
|
|
type='text',
|
2023-06-23 07:43:03 +01:00
|
|
|
id=id,
|
2023-07-16 21:45:30 +01:00
|
|
|
filename=comment_path(id),
|
2023-06-23 03:32:51 +01:00
|
|
|
data={{data=''}},
|
|
|
|
width=Width,
|
|
|
|
depth=depth+1,
|
2023-07-16 21:45:30 +01:00
|
|
|
metadata={parent=parent_id, replies={}},
|
2023-06-23 03:32:51 +01:00
|
|
|
border=Border_color,
|
|
|
|
}
|
2023-06-23 07:43:03 +01:00
|
|
|
save_metadata(comment)
|
2023-06-23 03:32:51 +01:00
|
|
|
local result = cols(20)
|
|
|
|
table.insert(result.data, indent(depth+1))
|
|
|
|
local item_stuff = rows()
|
|
|
|
table.insert(result.data, item_stuff)
|
|
|
|
table.insert(item_stuff.data, comment)
|
2023-06-23 07:43:03 +01:00
|
|
|
table.insert(item_stuff.data,
|
|
|
|
reply_button(comment.id, depth+1))
|
|
|
|
return result, id
|
2023-07-16 21:45:30 +01:00
|
|
|
end
|