Skip to content
Snippets Groups Projects
Commit 39cfb65c authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Add option to mention to 'all' in popup

parent cd9b6b2f
No related branches found
No related tags found
No related merge requests found
......@@ -167,7 +167,7 @@ Template.messagePopup.helpers
template = Template.instance()
filter = template.textFilter.get()
result = template.data.getFilter template.data.collection, filter
if (template.data.collection instanceof Meteor.Collection and result.count() is 0) or result?.length is 0
if (template.data.collection instanceof Meteor.Collection and result.count? and result.count() is 0) or result?.length is 0
template.open.set false
return result
......@@ -9,8 +9,22 @@ Template.messagePopupConfig.helpers
getInput: self.getInput
getFilter: (collection, filter) ->
exp = new RegExp(filter, 'i')
return collection.find({username: {$exists: true}, $or: [{name: exp}, {username: exp}]}, {limit: 10})
items = collection.find({username: {$exists: true}, $or: [{name: exp}, {username: exp}]}, {limit: 10}).fetch()
all =
_id: '@all'
username: '@all'
name: t 'Notify_all_in_this_room'
compatibility: 'channel group'
if exp.test(all.username) or exp.test(all.name) or exp.test(all.compatibility)
items.unshift all
return items
getValue: (_id, collection) ->
if _id is '@all'
return 'all'
return collection.findOne(_id)?.username
return config
......
......@@ -102,6 +102,7 @@
"Not_allowed" : "Not allowed",
"Not_found_or_not_allowed" : "Not Found or Not Allowed",
"Nothing_found" : "Nothing found",
"Notify_all_in_this_room": "Notify all in this room",
"Online" : "Online",
"Oops!" : "Oops",
"others": "others",
......
......@@ -100,6 +100,7 @@
"Not_allowed" : "Não permitido",
"Not_found_or_not_allowed" : "Não encontrado ou não permitido",
"Nothing_found" : "Nada encontrado",
"Notify_all_in_this_room": "Notificar todos nesta sala",
"Online" : "Online",
"Oops!" : "Ops",
"others" : "outros",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment