Skip to content

Commit

Permalink
Merge pull request #27 from flowdock/remove-tag-lists
Browse files Browse the repository at this point in the history
Generalize mentionsTags to be able to eventually remove tag lists
  • Loading branch information
Mumakil committed Apr 10, 2015
2 parents 43c5e5a + 3eaed2a commit 42f9fe9
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions flowdock-text.js
Expand Up @@ -963,26 +963,20 @@ if (typeof FlowdockText === "undefined" || FlowdockText === null) {
};
};

FlowdockText.mentionsAllTags = ["@everyone", "@everybody", "@all", "@anyone", "@anybody"];

FlowdockText.mentionsAll = function(check){
FlowdockText.mentionsTags = function(check, tags){
if(isArray(check)){
return FlowdockText.mentionsAllTags.some(function(tag) {
return downCase(check).indexOf(tag) !== -1;
});
if (isArray(tags)){
return tags.some(function(tag) {
return downCase(check).indexOf(tag) !== -1;
});
} else {
return downCase(check).indexOf(tags) !== -1;
}
} else {
return FlowdockText.mentionsAll(FlowdockText.extractMentions(check));
return FlowdockText.mentionsTags(FlowdockText.extractMentions(check), tags);
}
};

FlowdockText.mentionsTeam = function(check){
if(isArray(check)){
return downCase(check).indexOf("@team") !== -1;
} else {
return FlowdockText.mentionsTeam(FlowdockText.extractMentions(check));
}
}

FlowdockText.mentionsUser = function(check, user){
if(isArray(check)){
return downCase(check).indexOf(getUserTag(user).toLowerCase()) !== -1;
Expand Down

0 comments on commit 42f9fe9

Please sign in to comment.