Chatwoot/app/controllers/api/v1/labels_controller.rb
Subin T P b3264a0d7b
Feature: API to get most used labels (#447)
* Add most-used labels API

* Filter conversation by labels

* Move match_all to any query

Co-authored-by: Pranav Raj S <pranavrajs@gmail.com>
2020-02-02 16:29:18 +05:30

9 lines
248 B
Ruby

class Api::V1::LabelsController < Api::BaseController
def index # list all labels in account
@labels = current_account.all_conversation_tags
end
def most_used
@labels = ActsAsTaggableOn::Tag.most_used(params[:count] || 10)
end
end