Skip to content
Extraits de code Groupes Projets
Valider b98af83c rédigé par Steffen van Bergerem's avatar Steffen van Bergerem Validation de Dennis Schubert
Parcourir les fichiers

Sort tag search result by name

closes #6734
parent 98d76af3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# 0.5.8.0 # 0.5.8.0
## Refactor ## Refactor
* Sort tag autocompletion by tag name [#6734](https://github.com/diaspora/diaspora/pull/6734)
## Bug fixes ## Bug fixes
* Fix empty name field when editing aspect names [#6706](https://github.com/diaspora/diaspora/pull/6706) * Fix empty name field when editing aspect names [#6706](https://github.com/diaspora/diaspora/pull/6706)
......
...@@ -8,7 +8,7 @@ module ActsAsTaggableOn ...@@ -8,7 +8,7 @@ module ActsAsTaggableOn
end end
def self.autocomplete(name) def self.autocomplete(name)
where("name LIKE ?", "#{name.downcase}%") where("name LIKE ?", "#{name.downcase}%").order("name ASC")
end end
def self.normalize(name) def self.normalize(name)
......
...@@ -13,6 +13,12 @@ describe ActsAsTaggableOn::Tag, :type => :model do ...@@ -13,6 +13,12 @@ describe ActsAsTaggableOn::Tag, :type => :model do
it "does an end where on tags" do it "does an end where on tags" do
expect(tag.autocomplete("CAT")).to eq([tag_cats]) expect(tag.autocomplete("CAT")).to eq([tag_cats])
end end
it "sorts the results by name" do
tag_cat = tag.create(name: "cat")
tag_catt = tag.create(name: "catt")
expect(tag.autocomplete("CAT")).to eq([tag_cat, tag_cats, tag_catt])
end
end end
describe ".normalize" do describe ".normalize" do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter