Flush cache for undeletes - dont show profile disabled site suggestions

This commit is contained in:
Kyle Drake 2020-04-13 11:32:23 -07:00
parent dffba2a532
commit bf00086074

View file

@ -500,6 +500,8 @@ class Site < Sequel::Model
self.is_deleted = false self.is_deleted = false
save_changes save_changes
} }
delete_all_cache
true true
end end
@ -1500,7 +1502,7 @@ class Site < Sequel::Model
end end
def suggestions(limit=SUGGESTIONS_LIMIT, offset=0) def suggestions(limit=SUGGESTIONS_LIMIT, offset=0)
suggestions_dataset = Site.exclude(id: id).exclude(is_deleted: true).exclude(is_nsfw: true).order(:views.desc, :updated_at.desc) suggestions_dataset = Site.exclude(id: id).exclude(is_deleted: true).exclude(is_nsfw: true).exclude(profile_enabled: false).order(:views.desc, :updated_at.desc)
suggestions = suggestions_dataset.where(tags: tags).limit(limit, offset).all suggestions = suggestions_dataset.where(tags: tags).limit(limit, offset).all
return suggestions if suggestions.length == limit return suggestions if suggestions.length == limit