3 var MAX_TAG_LENGTH
= 20;
4 var MAX_STAFF_TAG_LENGTH
= 50;
6 var getMaxTagLength = function(isStaff
) {
7 return isStaff
? MAX_STAFF_TAG_LENGTH
: MAX_TAG_LENGTH
;
10 var validateTag = function(tagName
, isStaff
) {
11 var reservedTagTestRegex
= /:/;
15 if (!isStaff
&& reservedTagTestRegex
.test(tagName
)) {
16 messageList
.push('Tags can not use `:` colons.');
19 var tagLength
= !!tagName
&& tagName
.length
;
20 var maxTagLength
= getMaxTagLength(isStaff
);
21 if (!tagLength
|| tagLength
<= 0 || tagLength
> maxTagLength
) {
22 messageList
.push('Tags must be between 1 and ' + maxTagLength
+ ' characters in length.');
33 validateTag
: validateTag
,
34 getMaxTagLength
: getMaxTagLength