fix tag sort upon save (#25)

This commit is contained in:
Parziphal 2013-11-17 01:24:38 -05:00
parent c849ad1da7
commit 69b6c0cbcd

View File

@ -313,7 +313,6 @@ trait PostTagMethods
// $this->tags = implode(' ', array_unique(TagImplication::with_implied(TagAlias::to_aliased($this->new_tags)))); // $this->tags = implode(' ', array_unique(TagImplication::with_implied(TagAlias::to_aliased($this->new_tags))));
$this->new_tags = TagAlias::to_aliased($this->new_tags); $this->new_tags = TagAlias::to_aliased($this->new_tags);
$this->new_tags = array_unique(TagImplication::with_implied($this->new_tags)); $this->new_tags = array_unique(TagImplication::with_implied($this->new_tags));
sort($this->new_tags);
// $this->tags = implode(' ', $this->tags()); // $this->tags = implode(' ', $this->tags());
# TODO: be more selective in deleting from the join table # TODO: be more selective in deleting from the join table
@ -352,6 +351,10 @@ trait PostTagMethods
} }
} }
# Sort
sort($new_tags_names);
sort($this->new_tags);
$tag_set = implode(", ", array_map(function($x){return "(".$this->id.", ".$x->id.")";}, $this->new_tags)); $tag_set = implode(", ", array_map(function($x){return "(".$this->id.", ".$x->id.")";}, $this->new_tags));
$this->cached_tags = implode(' ', $new_tags_names); $this->cached_tags = implode(' ', $new_tags_names);