diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-10-25 20:48:45 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-10-25 20:48:45 +0900 |
| commit | a41a05de317403cdf155bf8df7862aefc8f5c56e (patch) | |
| tree | c5d5ed1d4ff34777e7d9445fdbc757faf2a2311f /src/web/app | |
| parent | Better English (diff) | |
| download | sharkey-a41a05de317403cdf155bf8df7862aefc8f5c56e.tar.gz sharkey-a41a05de317403cdf155bf8df7862aefc8f5c56e.tar.bz2 sharkey-a41a05de317403cdf155bf8df7862aefc8f5c56e.zip | |
Fix #89
Diffstat (limited to 'src/web/app')
| -rw-r--r-- | src/web/app/desktop/tags/timeline.tag | 30 | ||||
| -rw-r--r-- | src/web/app/desktop/tags/ui.tag | 30 | ||||
| -rw-r--r-- | src/web/app/mobile/tags/timeline.tag | 30 | ||||
| -rw-r--r-- | src/web/app/mobile/tags/ui.tag | 2 |
4 files changed, 56 insertions, 36 deletions
diff --git a/src/web/app/desktop/tags/timeline.tag b/src/web/app/desktop/tags/timeline.tag index cd7ac7d207..2d6b439e38 100644 --- a/src/web/app/desktop/tags/timeline.tag +++ b/src/web/app/desktop/tags/timeline.tag @@ -424,6 +424,7 @@ import compile from '../../common/scripts/text-compiler'; import dateStringify from '../../common/scripts/date-stringify'; + this.mixin('i'); this.mixin('api'); this.mixin('stream'); this.mixin('user-preview'); @@ -462,24 +463,31 @@ }; this.capture = withHandler => { - this.stream.send({ - type: 'capture', - id: this.post.id - }); - if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated); + if (this.SIGNIN) { + this.stream.send({ + type: 'capture', + id: this.post.id + }); + if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated); + } }; this.decapture = withHandler => { - this.stream.send({ - type: 'decapture', - id: this.post.id - }); - if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated); + if (this.SIGNIN) { + this.stream.send({ + type: 'decapture', + id: this.post.id + }); + if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated); + } }; this.on('mount', () => { this.capture(true); - this.stream.on('_connected_', this.onStreamConnected); + + if (this.SIGNIN) { + this.stream.on('_connected_', this.onStreamConnected); + } if (this.p.text) { const tokens = this.p.ast; diff --git a/src/web/app/desktop/tags/ui.tag b/src/web/app/desktop/tags/ui.tag index fce0743ff7..e0d7393b08 100644 --- a/src/web/app/desktop/tags/ui.tag +++ b/src/web/app/desktop/tags/ui.tag @@ -5,7 +5,7 @@ <div class="content"> <yield /> </div> - <mk-stream-indicator/> + <mk-stream-indicator if={ SIGNIN }/> <style> :scope display block @@ -416,22 +416,26 @@ this.page = this.opts.page; this.on('mount', () => { - this.stream.on('read_all_messaging_messages', this.onReadAllMessagingMessages); - this.stream.on('unread_messaging_message', this.onUnreadMessagingMessage); + if (this.SIGNIN) { + this.stream.on('read_all_messaging_messages', this.onReadAllMessagingMessages); + this.stream.on('unread_messaging_message', this.onUnreadMessagingMessage); - // Fetch count of unread messaging messages - this.api('messaging/unread').then(res => { - if (res.count > 0) { - this.update({ - hasUnreadMessagingMessages: true - }); - } - }); + // Fetch count of unread messaging messages + this.api('messaging/unread').then(res => { + if (res.count > 0) { + this.update({ + hasUnreadMessagingMessages: true + }); + } + }); + } }); this.on('unmount', () => { - this.stream.off('read_all_messaging_messages', this.onReadAllMessagingMessages); - this.stream.off('unread_messaging_message', this.onUnreadMessagingMessage); + if (this.SIGNIN) { + this.stream.off('read_all_messaging_messages', this.onReadAllMessagingMessages); + this.stream.off('unread_messaging_message', this.onUnreadMessagingMessage); + } }); this.onReadAllMessagingMessages = () => { diff --git a/src/web/app/mobile/tags/timeline.tag b/src/web/app/mobile/tags/timeline.tag index 5ecc2df9d1..c7f5bfd681 100644 --- a/src/web/app/mobile/tags/timeline.tag +++ b/src/web/app/mobile/tags/timeline.tag @@ -467,6 +467,7 @@ import getPostSummary from '../../../../common/get-post-summary.ts'; import openPostForm from '../scripts/open-post-form'; + this.mixin('i'); this.mixin('api'); this.mixin('stream'); @@ -502,24 +503,31 @@ }; this.capture = withHandler => { - this.stream.send({ - type: 'capture', - id: this.post.id - }); - if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated); + if (this.SIGNIN) { + this.stream.send({ + type: 'capture', + id: this.post.id + }); + if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated); + } }; this.decapture = withHandler => { - this.stream.send({ - type: 'decapture', - id: this.post.id - }); - if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated); + if (this.SIGNIN) { + this.stream.send({ + type: 'decapture', + id: this.post.id + }); + if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated); + } }; this.on('mount', () => { this.capture(true); - this.stream.on('_connected_', this.onStreamConnected); + + if (this.SIGNIN) { + this.stream.on('_connected_', this.onStreamConnected); + } if (this.p.text) { const tokens = this.p.ast; diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag index b2f738dc2e..9d9cd4d74a 100644 --- a/src/web/app/mobile/tags/ui.tag +++ b/src/web/app/mobile/tags/ui.tag @@ -4,7 +4,7 @@ <div class="content"> <yield /> </div> - <mk-stream-indicator/> + <mk-stream-indicator if={ SIGNIN }/> <style> :scope display block |