From 52f2416d889d51210bcd42c0976cd57626d06928 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 3 May 2018 22:51:01 -0700 Subject: [PATCH] added claim availability check for channels via saga --- server/controllers/api/channel/availability/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/controllers/api/channel/availability/index.js b/server/controllers/api/channel/availability/index.js index eb4a0c53..dace8e01 100644 --- a/server/controllers/api/channel/availability/index.js +++ b/server/controllers/api/channel/availability/index.js @@ -8,9 +8,16 @@ const { handleErrorResponse } = require('../../../utils/errorHandlers.js'); */ +function addAtSymbolIfNecessary (name) { + if (name.substring(0,1) !== '@') { + return `@${name}`; + } + return name; +} + const channelAvailability = ({ ip, originalUrl, params: { name } }, res) => { const gaStartTime = Date.now(); - let name = `@${name}`; + name = addAtSymbolIfNecessary(name); checkChannelAvailability(name) .then(isAvailable => { let responseObject = {