From 85bfd99f82140a9a47a58e00c0da0d710b09619f Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Mon, 23 Nov 2015 12:18:45 -0800 Subject: [PATCH] hide talk stations/writing ui when accessed by another ship --- pub/talk/hymn.hook | 2 +- pub/talk/src/js/components/StationComponent.coffee | 3 +++ pub/talk/src/js/components/WritingComponent.coffee | 5 ++++- pub/talk/src/js/main.js | 12 +++++++++++- pub/talk/src/js/util.coffee | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/pub/talk/hymn.hook b/pub/talk/hymn.hook index a8abed343..336346542 100644 --- a/pub/talk/hymn.hook +++ b/pub/talk/hymn.hook @@ -22,7 +22,7 @@ "react/0.13.1/react.js" == :: remove /~~ for anon - ;script(type "text/javascript", src "/~~/~/at/home/lib/urb.js"); + ;script(type "text/javascript", src "/~/at/home/lib/urb.js"); ;meta(name "viewport", content "width=device-width, height=device-height, ". "initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"); ;link(type "text/css", rel "stylesheet", href "/home/pub/talk/src/css/main.css"); diff --git a/pub/talk/src/js/components/StationComponent.coffee b/pub/talk/src/js/components/StationComponent.coffee index f6973e028..6de1be1dd 100644 --- a/pub/talk/src/js/components/StationComponent.coffee +++ b/pub/talk/src/js/components/StationComponent.coffee @@ -73,6 +73,9 @@ module.exports = recl StationActions.setSources @state.station,_sources render: -> + if window.urb.user isnt window.urb.ship #foreign + return div {id:"station"} + parts = [] members = [] diff --git a/pub/talk/src/js/components/WritingComponent.coffee b/pub/talk/src/js/components/WritingComponent.coffee index fd8bf36bf..158a0f871 100644 --- a/pub/talk/src/js/components/WritingComponent.coffee +++ b/pub/talk/src/js/components/WritingComponent.coffee @@ -251,6 +251,9 @@ module.exports = recl _onChangeStore: -> @setState @stateFromStore() render: -> + if window.urb.user isnt window.urb.ship #foreign + return div {className:"writing"} + user = "~"+window.urb.user iden = StationStore.getMember(user) ship = if iden then iden.ship else user @@ -262,7 +265,7 @@ module.exports = recl audi[k] = v.slice(1) k = "writing" - + div {className:k}, [ (div {className:"attr"}, [ (React.createElement Member, iden) diff --git a/pub/talk/src/js/main.js b/pub/talk/src/js/main.js index 3c5d2a4fd..7029cf401 100644 --- a/pub/talk/src/js/main.js +++ b/pub/talk/src/js/main.js @@ -648,6 +648,11 @@ module.exports = recl({ }, render: function() { var _remove, _sources, members, parts, sourceCtrl, sourceInput, sources; + if (window.urb.user !== window.urb.ship) { + return div({ + id: "station" + }); + } parts = []; members = []; if (this.state.station && this.state.members) { @@ -988,6 +993,11 @@ module.exports = recl({ }, render: function() { var audi, iden, k, name, ship, user, v; + if (window.urb.user !== window.urb.ship) { + return div({ + className: "writing" + }); + } user = "~" + window.urb.user; iden = StationStore.getMember(user); ship = iden ? iden.ship : user; @@ -6719,7 +6729,7 @@ _.merge(window.util, { }, mainStation: function(user) { if (user == null) { - user = window.urb.user; + user = window.urb.ship; } switch (user.length) { case 3: diff --git a/pub/talk/src/js/util.coffee b/pub/talk/src/js/util.coffee index 7841ab2fd..19ec81eb8 100644 --- a/pub/talk/src/js/util.coffee +++ b/pub/talk/src/js/util.coffee @@ -5,7 +5,7 @@ _.merge window.util, mainStationPath: (user = window.urb.user) -> "~#{user}/#{window.util.mainStation(user)}" - mainStation: (user = window.urb.user) -> + mainStation: (user = window.urb.ship) -> switch user.length when 3 return "court"