Fixed post snapshots being non-deterministic

This commit is contained in:
Marcin Kurczewski 2014-10-26 00:06:53 +02:00
parent a9d8383f7d
commit eefdfd7834
2 changed files with 7 additions and 5 deletions

1
TODO
View file

@ -4,7 +4,6 @@ first major release.
- autocomplete: don't show items that are already used in tag list (unsure) - autocomplete: don't show items that are already used in tag list (unsure)
- posts/upload: ability to paste many urls (unsure) - posts/upload: ability to paste many urls (unsure)
- posts/listing: add buttons for toggling safety - posts/listing: add buttons for toggling safety
- posts: fix empty edit snapshots when changing only thumbnail content
- users: add user-configurable "about me" (should support Markdown) - users: add user-configurable "about me" (should support Markdown)
- tags: refresh tags.json when editing post - tags: refresh tags.json when editing post
- tags: add tag merging - tags: add tag merging

View file

@ -34,24 +34,27 @@ class PostSnapshotProvider
'featured' => $isFeatured, 'featured' => $isFeatured,
'tags' => 'tags' =>
array_map( array_values(array_map(
function ($tag) function ($tag)
{ {
return $tag->getName(); return $tag->getName();
}, },
$post->getTags()), $post->getTags())),
'relations' => 'relations' =>
array_map( array_values(array_map(
function ($post) function ($post)
{ {
return $post->getId(); return $post->getId();
}, },
$post->getRelatedPosts()), $post->getRelatedPosts())),
'flags' => $flags, 'flags' => $flags,
]; ];
sort($data['tags']);
sort($data['relations']);
$snapshot = $this->getPostSnapshot($post); $snapshot = $this->getPostSnapshot($post);
$snapshot->setOperation(Snapshot::OPERATION_CHANGE); $snapshot->setOperation(Snapshot::OPERATION_CHANGE);
$snapshot->setData($data); $snapshot->setData($data);