Show all tags in drop-down on one page?

How to make the router /support available only administrator

Discourse.filters.push(:support)
after_initialize do
 require_dependency 'topic_query'
 class ::TopicQuery
   def list_support(excluded_topic_ids = [])
     excluded_topic_ids += Category.topic_ids.to_a
     create_list(:support, unordered: true, status: 'listed') do |topics|
       topics = topics.where("topics.id NOT IN (?)", excluded_topic_ids)
     end
   end
 end

 require_dependency 'list_controller'
 class ::ListController
   def support_feed
     list = generate_list_for("support", target_user, list_opts)
     respond_with_list(list)
   end
 end

 Discourse::Application.routes.append do
   get "support" => "list#support_feed"
 end

end
  class User < ActiveRecord::Base
authenticate :user, lambda { |u| u.admin? } do
  Discourse::Application.routes.append do
    get "support" => "list#support_feed"
  end
end

why? undefined method `authenticate’

Not sure I understand what’s going on here? Are you having any issues? Can you elaborate?

1 Like

Thank you for your interest in the issue.

I want to make route /support available only administrator.

And https://meta.discourse.org/search?expanded=true&q=status%3Anoreplies
how to request status:noreplies to create_list(:support, {}, latest_results)

Like this?

https://github.com/discourse/discourse/blob/master/config/routes.rb#L30

Yes, only administrator, moderator

like that on js
if (currentUser.admin || currentUser.moderator)

There’s AdminConstraint and StaffConstraint. Those should get you there.

4 Likes