Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSPB-308: Check for UTF-8 character in extensions in SmartPBX #468

Merged
merged 5 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ define(function(require) {
var self = this;
},

isExtensionDisplayable: function(number) {
var isAlphanumericExtensionsEnabled = monster.util.isFeatureAvailable('smartpbx.users.settings.utfExtensions.show');
Isaac2600Hz marked this conversation as resolved.
Show resolved Hide resolved
if (isAlphanumericExtensionsEnabled) {
return true;
}
var regex = /\D/;
var isAlphanumericExtension = regex.test(number);
return !isAlphanumericExtension;
},

loadGlobalData: function(callback) {
var self = this;

Expand Down
10 changes: 7 additions & 3 deletions submodules/users/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,14 +448,16 @@ define(function(require) {
var extensions = _
.chain(numbers)
.filter(function(number) {
return _.size(number) < 7;
if (_.size(number) < 7) {
Isaac2600Hz marked this conversation as resolved.
Show resolved Hide resolved
return self.isExtensionDisplayable(number);
}
return false;
})
.concat(extra.listExtensions)
.value(),
phoneNumbers = _.filter(numbers, function(number) {
return _.size(number) >= 7;
});

return {
listExtensions: extensions,
listCallerId: phoneNumbers,
Expand Down Expand Up @@ -3872,7 +3874,9 @@ define(function(require) {

response.assignedNumbers.push(numberElement);
} else {
response.extensions.push(number);
if (self.isExtensionDisplayable(number)) {
Isaac2600Hz marked this conversation as resolved.
Show resolved Hide resolved
response.extensions.push(number);
}
}
});
}
Expand Down