2017-06-28 16:56:44 -04:00
|
|
|
class WatchedWordListSerializer < ApplicationSerializer
|
2017-09-27 15:48:57 -04:00
|
|
|
attributes :actions, :words, :regular_expressions
|
2017-06-28 16:56:44 -04:00
|
|
|
|
|
|
|
def actions
|
|
|
|
WatchedWord.actions.keys
|
|
|
|
end
|
|
|
|
|
|
|
|
def words
|
|
|
|
object.map do |word|
|
|
|
|
WatchedWordSerializer.new(word, root: false)
|
|
|
|
end
|
|
|
|
end
|
2017-09-27 15:48:57 -04: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 16:56:44 -04:00
|
|
|
end
|