favgroups: unify find by name methods.

Unify the `name_to_id`, `named`, and `find_by_name` methods into a
single `find_by_name_or_id` method that has consistent behavior in how
names are normalized.
This commit is contained in:
evazion
2020-01-17 13:25:15 -06:00
parent d461bb2ad0
commit e6ffdfdf81
4 changed files with 19 additions and 47 deletions

View File

@@ -52,7 +52,7 @@ module PostSets
name = Tag.has_metatag?(tag_array, :favgroup)
return nil unless is_single_tag? && name.present?
@favgroup ||= FavoriteGroup.find_by_name(name)
@favgroup ||= FavoriteGroup.find_by_name_or_id(name, CurrentUser.user)
end
def has_explicit?