summaryrefslogtreecommitdiffstats
path: root/webapp/actions/channel_actions.jsx
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2017-02-27 17:41:12 -0300
committerChristopher Speller <crspeller@gmail.com>2017-02-27 15:41:12 -0500
commit48f97a5a2a0754bfc0e639db7cce03943e990e32 (patch)
tree74d6a48d467d245e62f1e3c526a9abf9413c71a9 /webapp/actions/channel_actions.jsx
parent72de977c522465bc2ee044cd4a26baf666f299a3 (diff)
downloadchat-48f97a5a2a0754bfc0e639db7cce03943e990e32.tar.gz
chat-48f97a5a2a0754bfc0e639db7cce03943e990e32.tar.bz2
chat-48f97a5a2a0754bfc0e639db7cce03943e990e32.zip
PLT-5653 Fix Create channel does not show in another device (#5548)
Diffstat (limited to 'webapp/actions/channel_actions.jsx')
-rw-r--r--webapp/actions/channel_actions.jsx47
1 files changed, 27 insertions, 20 deletions
diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx
index 3528b4480..5f41d127d 100644
--- a/webapp/actions/channel_actions.jsx
+++ b/webapp/actions/channel_actions.jsx
@@ -335,27 +335,34 @@ export function createChannel(channel, success, error) {
Client.createChannel(
channel,
(data) => {
- Client.getChannel(
- data.id,
- (data2) => {
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_CHANNEL,
- channel: data2.channel,
- member: data2.channel
- });
-
- if (success) {
- success(data2);
- }
- },
- (err) => {
- AsyncClient.dispatchError(err, 'getChannel');
-
- if (error) {
- error(err);
- }
+ const existing = ChannelStore.getChannelById(data.id);
+ if (existing) {
+ if (success) {
+ success({channel: existing});
}
- );
+ } else {
+ Client.getChannel(
+ data.id,
+ (data2) => {
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_CHANNEL,
+ channel: data2.channel,
+ member: data2.channel
+ });
+
+ if (success) {
+ success(data2);
+ }
+ },
+ (err) => {
+ AsyncClient.dispatchError(err, 'getChannel');
+
+ if (error) {
+ error(err);
+ }
+ }
+ );
+ }
},
(err) => {
AsyncClient.dispatchError(err, 'createChannel');