summaryrefslogtreecommitdiffstats
path: root/webapp/components/view_image.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-05-05 16:35:03 -0400
committerChristopher Speller <crspeller@gmail.com>2016-05-05 16:35:03 -0400
commitd2ddf40f56191c1770c3ca93d747a7f1b749f26c (patch)
tree9cd5d9ac9fc5b9da21fba8df9990c5f927801272 /webapp/components/view_image.jsx
parent696ffb4745bec6306f88c5693b8ded89a47f5de7 (diff)
downloadchat-d2ddf40f56191c1770c3ca93d747a7f1b749f26c.tar.gz
chat-d2ddf40f56191c1770c3ca93d747a7f1b749f26c.tar.bz2
chat-d2ddf40f56191c1770c3ca93d747a7f1b749f26c.zip
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
Diffstat (limited to 'webapp/components/view_image.jsx')
-rw-r--r--webapp/components/view_image.jsx28
1 files changed, 7 insertions, 21 deletions
diff --git a/webapp/components/view_image.jsx b/webapp/components/view_image.jsx
index bd4aeaa41..b88df19d4 100644
--- a/webapp/components/view_image.jsx
+++ b/webapp/components/view_image.jsx
@@ -3,7 +3,7 @@
import $ from 'jquery';
import * as AsyncClient from 'utils/async_client.jsx';
-import Client from 'utils/web_client.jsx';
+import * as GlobalActions from 'action_creators/global_actions.jsx';
import * as Utils from 'utils/utils.jsx';
import AudioVideoPreview from './audio_video_preview.jsx';
import Constants from 'utils/constants.jsx';
@@ -43,7 +43,7 @@ class ViewImageModal extends React.Component {
this.onFileStoreChange = this.onFileStoreChange.bind(this);
- this.getPublicLink = this.getPublicLink.bind(this);
+ this.handleGetPublicLink = this.handleGetPublicLink.bind(this);
this.onMouseEnterImage = this.onMouseEnterImage.bind(this);
this.onMouseLeaveImage = this.onMouseLeaveImage.bind(this);
@@ -194,24 +194,10 @@ class ViewImageModal extends React.Component {
}
}
- getPublicLink() {
- var data = {};
- data.channel_id = this.props.channelId;
- data.user_id = this.props.userId;
- data.filename = this.props.filenames[this.state.imgId];
- Client.getPublicLink(
- data,
- (serverData) => {
- if (Utils.isMobile()) {
- window.location.href = serverData.public_link;
- } else {
- window.open(serverData.public_link);
- }
- },
- () => {
- //Do Nothing on error
- }
- );
+ handleGetPublicLink() {
+ this.props.onModalDismissed();
+
+ GlobalActions.showGetPublicLinkModal(this.props.channelId, this.props.userId, this.props.filenames[this.state.imgId]);
}
onMouseEnterImage() {
@@ -349,7 +335,7 @@ class ViewImageModal extends React.Component {
totalFiles={this.props.filenames.length}
filename={name}
fileURL={fileUrl}
- getPublicLink={this.getPublicLink}
+ onGetPublicLink={this.handleGetPublicLink}
/>
</div>
</div>