From d2ddf40f56191c1770c3ca93d747a7f1b749f26c Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 5 May 2016 16:35:03 -0400 Subject: PLT-2600/PLT-2770 Added Get Public Link modal and added new API for public file links (#2892) * Switched public file links to use a GetLinkModal * Separated getFile and the new getPublicFile api calls --- webapp/utils/async_client.jsx | 30 ++++++++++++++++++++++++++++++ webapp/utils/constants.jsx | 1 + 2 files changed, 31 insertions(+) (limited to 'webapp/utils') diff --git a/webapp/utils/async_client.jsx b/webapp/utils/async_client.jsx index 57888f722..ac651a7bb 100644 --- a/webapp/utils/async_client.jsx +++ b/webapp/utils/async_client.jsx @@ -1343,3 +1343,33 @@ export function regenCommandToken(id) { } ); } + +export function getPublicLink(channelId, userId, filename, success, error) { + const callName = 'getPublicLink' + channelId + userId + filename; + + if (isCallInProgress(callName)) { + return; + } + + callTracker[callName] = utils.getTimestamp(); + + Client.getPublicLink( + channelId, + userId, + filename, + (link) => { + callTracker[callName] = 0; + + success(link); + }, + (err) => { + callTracker[callName] = 0; + + if (error) { + error(err); + } else { + dispatchError(err, 'getPublicLink'); + } + } + ); +} \ No newline at end of file diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx index 3ae99d7fa..fb4086c7a 100644 --- a/webapp/utils/constants.jsx +++ b/webapp/utils/constants.jsx @@ -110,6 +110,7 @@ export default { TOGGLE_GET_POST_LINK_MODAL: null, TOGGLE_GET_TEAM_INVITE_LINK_MODAL: null, TOGGLE_REGISTER_APP_MODAL: null, + TOGGLE_GET_PUBLIC_LINK_MODAL: null, SUGGESTION_PRETEXT_CHANGED: null, SUGGESTION_RECEIVED_SUGGESTIONS: null, -- cgit v1.2.3-1-g7c22