Fixed flmt being the same as creation time
This commit is contained in:
parent
65c9c89628
commit
a2b0d1cbd4
2 changed files with 6 additions and 3 deletions
|
@ -76,6 +76,7 @@ def create_post(
|
|||
flags = ctx.get_param_as_string_list(
|
||||
"flags", default=posts.get_default_flags(content)
|
||||
)
|
||||
file_last_modified_time = ctx.get_param_as_int("fileLastModifiedTime")
|
||||
|
||||
post, new_tags = posts.create_post(
|
||||
content, tag_names, None if anonymous else ctx.user
|
||||
|
@ -87,6 +88,7 @@ def create_post(
|
|||
posts.update_post_relations(post, relations)
|
||||
posts.update_post_notes(post, notes)
|
||||
posts.update_post_flags(post, flags)
|
||||
posts.update_post_file_last_modified_time(post, file_last_modified_time)
|
||||
if ctx.has_file("thumbnail"):
|
||||
posts.update_post_thumbnail(post, ctx.get_file("thumbnail"))
|
||||
ctx.session.add(post)
|
||||
|
|
|
@ -427,9 +427,10 @@ def create_post(
|
|||
|
||||
|
||||
def update_post_file_last_modified_time(post: model.Post, timestamp: int) -> None:
|
||||
assert post
|
||||
file_last_modified_time = datetime.fromtimestamp(ctx.get_param_as_int("lastModified", default=time.time()))
|
||||
post.file_last_modified_time = file_last_modified_time
|
||||
assert post
|
||||
|
||||
# Timestamp is in ms, so it must be divided by 1000 otherwise out of range
|
||||
post.file_last_modified_time = datetime.fromtimestamp(timestamp / 1000)
|
||||
|
||||
def update_post_safety(post: model.Post, safety: str) -> None:
|
||||
assert post
|
||||
|
|
Reference in a new issue