2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-28 15:56:44 -05:00
|
|
|
class WatchedWordListSerializer < ApplicationSerializer
|
2017-09-27 14:48:57 -05:00
|
|
|
attributes :actions, :words, :regular_expressions
|
2017-06-28 15:56:44 -05:00
|
|
|
|
|
|
|
def actions
|
|
|
|
WatchedWord.actions.keys
|
|
|
|
end
|
|
|
|
|
|
|
|
def words
|
|
|
|
object.map do |word|
|
|
|
|
WatchedWordSerializer.new(word, root: false)
|
|
|
|
end
|
|
|
|
end
|
2017-09-27 14:48:57 -05:00
|
|
|
|
|
|
|
# No point making this site setting `client: true` when it's only used
|
|
|
|
# in the admin section
|
|
|
|
def regular_expressions
|
|
|
|
SiteSetting.watched_words_regular_expressions?
|
|
|
|
end
|
2017-06-28 15:56:44 -05:00
|
|
|
end
|