summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-09-14 12:16:29 -0300
committerGitHub <noreply@github.com>2016-09-14 12:16:29 -0300
commitecd433d697878e614937ad0bcf125164034c0bf6 (patch)
tree45d2f2725ed933ac9ef0990e6d112ce21bcabc2d
parent6c678f540734c8e9f7a85e3565e8a73ddbed2f44 (diff)
downloadchat-ecd433d697878e614937ad0bcf125164034c0bf6.tar.gz
chat-ecd433d697878e614937ad0bcf125164034c0bf6.tar.bz2
chat-ecd433d697878e614937ad0bcf125164034c0bf6.zip
PLT-1238 on permalink not visible back button points to last channel or town-square (#4019)
-rw-r--r--webapp/actions/global_actions.jsx16
-rw-r--r--webapp/routes/route_team.jsx7
2 files changed, 19 insertions, 4 deletions
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx
index 75cdb8015..87bd20165 100644
--- a/webapp/actions/global_actions.jsx
+++ b/webapp/actions/global_actions.jsx
@@ -146,7 +146,7 @@ export function doFocusPost(channelId, postId, data) {
AsyncClient.getPostsAfter(postId, 0, Constants.POST_FOCUS_CONTEXT_RADIUS, true);
}
-export function emitPostFocusEvent(postId) {
+export function emitPostFocusEvent(postId, onSuccess) {
AsyncClient.getChannels(true);
Client.getPermalinkTmp(
postId,
@@ -156,9 +156,21 @@ export function emitPostFocusEvent(postId) {
}
const channelId = data.posts[data.order[0]].channel_id;
doFocusPost(channelId, postId, data);
+
+ if (onSuccess) {
+ onSuccess();
+ }
},
() => {
- browserHistory.push('/error?message=' + encodeURIComponent(Utils.localizeMessage('permalink.error.access', 'Permalink belongs to a deleted message or to a channel to which you do not have access.')));
+ let link = `${TeamStore.getCurrentTeamRelativeUrl()}/channels/`;
+ const channel = ChannelStore.getCurrent();
+ if (channel) {
+ link += channel.name;
+ } else {
+ link += 'town-square';
+ }
+
+ browserHistory.push('/error?message=' + encodeURIComponent(Utils.localizeMessage('permalink.error.access', 'Permalink belongs to a deleted message or to a channel to which you do not have access.')) + '&link=' + encodeURIComponent(link));
}
);
}
diff --git a/webapp/routes/route_team.jsx b/webapp/routes/route_team.jsx
index 71abd46fb..1b4e48a51 100644
--- a/webapp/routes/route_team.jsx
+++ b/webapp/routes/route_team.jsx
@@ -132,9 +132,12 @@ function preNeedsTeam(nextState, replace, callback) {
});
}
-function onPermalinkEnter(nextState) {
+function onPermalinkEnter(nextState, replace, callback) {
const postId = nextState.params.postid;
- GlobalActions.emitPostFocusEvent(postId);
+ GlobalActions.emitPostFocusEvent(
+ postId,
+ () => callback()
+ );
}
export default {