diff --git a/src/web/app/common/tags/file-type-icon.tag b/src/web/app/common/tags/file-type-icon.tag index c484a5749..55c473bcd 100644 --- a/src/web/app/common/tags/file-type-icon.tag +++ b/src/web/app/common/tags/file-type-icon.tag @@ -5,6 +5,6 @@ display inline diff --git a/src/web/app/common/tags/messaging/form.tag b/src/web/app/common/tags/messaging/form.tag index 649c16a25..4ae1706ff 100644 --- a/src/web/app/common/tags/messaging/form.tag +++ b/src/web/app/common/tags/messaging/form.tag @@ -150,23 +150,26 @@ event.one('selected', files => { files.forEach(this.addFile); }); + } send() { - this.sending = true - this.api 'messaging/messages/create' do - user_id: this.opts.user.id + this.sending = true; + this.api('messaging/messages/create', { + user_id: this.opts.user.id, text: this.refs.text.value - .then (message) => - @clear! - .catch (err) => - console.error err - .then => - this.sending = false + }).then(message => { + this.clear(); + }).catch(err => { + console.error(err); + }).then(() => { + this.sending = false; this.update(); + }); clear() { - this.refs.text.value = '' - this.files = [] + this.refs.text.value = ''; + this.files = []; this.update(); + } diff --git a/src/web/app/common/tags/messaging/index.tag b/src/web/app/common/tags/messaging/index.tag index f9ce48641..d49596c87 100644 --- a/src/web/app/common/tags/messaging/index.tag +++ b/src/web/app/common/tags/messaging/index.tag @@ -289,29 +289,27 @@ this.mixin('i'); this.mixin('api'); - this.search-result = [] + this.searchResult = []; this.on('mount', () => { - this.api 'messaging/history' - .then (history) => - this.is-loading = false - history.for-each (message) => - message.is_me = message.user_id == @I.id - message._click = => - if message.is_me - this.trigger 'navigate-user' message.recipient - else - this.trigger 'navigate-user' message.user - this.history = history + this.api('messaging/history').then(history => { + this.isLoading = false; + history.forEach(message => { + message.is_me = message.user_id == this.I.id + message._click = () => { + this.trigger('navigate-user', message.is_me ? message.recipient : message.user); + }; + }); + this.history = history; this.update(); - .catch (err) => - console.error err + }); + } search() { - q = this.refs.search.value - if q == '' - this.search-result = [] - else + const q = this.refs.search.value; + if (q == '') { + this.searchResult = []; + } else { this.api 'users/search' do query: q max: 5 diff --git a/src/web/app/common/tags/messaging/message.tag b/src/web/app/common/tags/messaging/message.tag index a43991e0e..96b4e8daf 100644 --- a/src/web/app/common/tags/messaging/message.tag +++ b/src/web/app/common/tags/messaging/message.tag @@ -207,7 +207,7 @@ this.mixin('text'); this.message = this.opts.message - @message.is_me = @message.user.id == @I.id + @message.is_me = @message.user.id == this.I.id this.on('mount', () => { if @message.text? diff --git a/src/web/app/common/tags/messaging/room.tag b/src/web/app/common/tags/messaging/room.tag index a571b330c..320af8a8b 100644 --- a/src/web/app/common/tags/messaging/room.tag +++ b/src/web/app/common/tags/messaging/room.tag @@ -133,7 +133,7 @@ this.sending = false this.messages = [] - this.connection = new @MessagingStreamConnection @I, @user.id + this.connection = new @MessagingStreamConnection this.I, @user.id this.on('mount', () => { @connection.event.on 'message' this.on-message @@ -169,7 +169,7 @@ is-bottom = @is-bottom! @messages.push message - if message.user_id != @I.id and not document.hidden + if message.user_id != this.I.id and not document.hidden @connection.socket.send JSON.stringify do type: 'read' id: message.id @@ -178,7 +178,7 @@ if is-bottom // Scroll to bottom @scroll-to-bottom! - else if message.user_id != @I.id + else if message.user_id != this.I.id // Notify @notify '新しいメッセージがあります' @@ -216,7 +216,7 @@ on-visibilitychange() { if document.hidden then return @messages.for-each (message) => - if message.user_id != @I.id and not message.is_read + if message.user_id != this.I.id and not message.is_read @connection.socket.send JSON.stringify do type: 'read' id: message.id diff --git a/src/web/app/common/tags/uploader.tag b/src/web/app/common/tags/uploader.tag index 2cf1aa324..72f6eaa22 100644 --- a/src/web/app/common/tags/uploader.tag +++ b/src/web/app/common/tags/uploader.tag @@ -164,7 +164,7 @@ reader.read-as-data-URL file data = new FormData! - data.append 'i' @I.token + data.append 'i' this.I.token data.append 'file' file if folder? diff --git a/src/web/app/desktop/tags/donation.tag b/src/web/app/desktop/tags/donation.tag index d92e24e30..b01c0a44d 100644 --- a/src/web/app/desktop/tags/donation.tag +++ b/src/web/app/desktop/tags/donation.tag @@ -54,11 +54,11 @@ e.prevent-default! e.stop-propagation! - @I.data.no_donation = true - @I.update! + this.I.data.no_donation = true + this.I.update! this.api 'i/appdata/set' do data: JSON.stringify do - no_donation: @I.data.no_donation + no_donation: this.I.data.no_donation this.unmount(); diff --git a/src/web/app/desktop/tags/drive/file-contextmenu.tag b/src/web/app/desktop/tags/drive/file-contextmenu.tag index 69073bd29..5919599be 100644 --- a/src/web/app/desktop/tags/drive/file-contextmenu.tag +++ b/src/web/app/desktop/tags/drive/file-contextmenu.tag @@ -81,15 +81,15 @@ set-avatar() { this.refs.ctx.close! - @update-avatar @I, null, @file + @update-avatar this.I, null, @file set-banner() { this.refs.ctx.close! - @update-banner @I, null, @file + @update-banner this.I, null, @file set-wallpaper() { this.refs.ctx.close! - @update-wallpaper @I, null, @file + @update-wallpaper this.I, null, @file add-app() { @NotImplementedException! diff --git a/src/web/app/desktop/tags/home-widgets/profile.tag b/src/web/app/desktop/tags/home-widgets/profile.tag index d8d1f6107..3cff6b682 100644 --- a/src/web/app/desktop/tags/home-widgets/profile.tag +++ b/src/web/app/desktop/tags/home-widgets/profile.tag @@ -47,9 +47,9 @@ this.mixin('update-banner'); set-avatar() { - @update-avatar @I + @update-avatar this.I set-banner() { - @update-banner @I + @update-banner this.I diff --git a/src/web/app/desktop/tags/home-widgets/timeline.tag b/src/web/app/desktop/tags/home-widgets/timeline.tag index 10918b5e0..1fcf4ab57 100644 --- a/src/web/app/desktop/tags/home-widgets/timeline.tag +++ b/src/web/app/desktop/tags/home-widgets/timeline.tag @@ -39,7 +39,7 @@ this.is-loading = true this.is-empty = false this.more-loading = false - this.no-following = @I.following_count == 0 + this.no-following = this.I.following_count == 0 this.on('mount', () => { @stream.on 'post' this.on-stream-post diff --git a/src/web/app/desktop/tags/home.tag b/src/web/app/desktop/tags/home.tag index 182f557b7..729022073 100644 --- a/src/web/app/desktop/tags/home.tag +++ b/src/web/app/desktop/tags/home.tag @@ -70,7 +70,7 @@ this.refs.tl.on('loaded', () => { this.trigger('loaded'); - @I.data.home.for-each (widget) => + this.I.data.home.for-each (widget) => try el = document.createElement 'mk-' + widget.name + '-home-widget' switch widget.place diff --git a/src/web/app/desktop/tags/pages/home.tag b/src/web/app/desktop/tags/pages/home.tag index 348762d2d..0f0bc4e37 100644 --- a/src/web/app/desktop/tags/pages/home.tag +++ b/src/web/app/desktop/tags/pages/home.tag @@ -35,7 +35,7 @@ document.remove-event-listener 'visibilitychange' @window-on-visibilitychange on-stream-post(post) { - if document.hidden and post.user_id !== @I.id + if document.hidden and post.user_id !== this.I.id @unread-count++ document.title = '(' + @unread-count + ') ' + @get-post-summary post diff --git a/src/web/app/desktop/tags/set-avatar-suggestion.tag b/src/web/app/desktop/tags/set-avatar-suggestion.tag index 858838743..149144edf 100644 --- a/src/web/app/desktop/tags/set-avatar-suggestion.tag +++ b/src/web/app/desktop/tags/set-avatar-suggestion.tag @@ -35,7 +35,7 @@ this.mixin('update-avatar'); set() { - @update-avatar @I + @update-avatar this.I close(e) { e.prevent-default! diff --git a/src/web/app/desktop/tags/set-banner-suggestion.tag b/src/web/app/desktop/tags/set-banner-suggestion.tag index 2a4ba8dbb..a1e9eb4ed 100644 --- a/src/web/app/desktop/tags/set-banner-suggestion.tag +++ b/src/web/app/desktop/tags/set-banner-suggestion.tag @@ -35,7 +35,7 @@ this.mixin('update-banner'); set() { - @update-banner @I + @update-banner this.I close(e) { e.prevent-default! diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag index 16369c2f4..e67a1b11a 100644 --- a/src/web/app/desktop/tags/settings.tag +++ b/src/web/app/desktop/tags/settings.tag @@ -209,7 +209,7 @@ this.page = page avatar() { - @update-avatar @I + @update-avatar this.I update-account() { this.api 'i/update' do @@ -223,21 +223,21 @@ console.error err update-cache() { - @I.data.cache = !@I.data.cache + this.I.data.cache = !this.I.data.cache this.api 'i/appdata/set' do data: JSON.stringify do - cache: @I.data.cache + cache: this.I.data.cache update-debug() { - @I.data.debug = !@I.data.debug + this.I.data.debug = !this.I.data.debug this.api 'i/appdata/set' do data: JSON.stringify do - debug: @I.data.debug + debug: this.I.data.debug update-nya() { - @I.data.nya = !@I.data.nya + this.I.data.nya = !this.I.data.nya this.api 'i/appdata/set' do data: JSON.stringify do - nya: @I.data.nya + nya: this.I.data.nya diff --git a/src/web/app/desktop/tags/user-header.tag b/src/web/app/desktop/tags/user-header.tag index dc7abb512..a2ed28b4f 100644 --- a/src/web/app/desktop/tags/user-header.tag +++ b/src/web/app/desktop/tags/user-header.tag @@ -132,10 +132,10 @@ this.refs.banner.style.filter = 'blur(' + blur + 'px)' on-update-banner() { - if not @SIGNIN or @I.id != @user.id + if not @SIGNIN or this.I.id != @user.id return - @update-banner @I, (i) => + @update-banner this.I, (i) => @user.banner_url = i.banner_url this.update(); diff --git a/src/web/app/mobile/tags/page/home.tag b/src/web/app/mobile/tags/page/home.tag index db87483a9..cfa6d55da 100644 --- a/src/web/app/mobile/tags/page/home.tag +++ b/src/web/app/mobile/tags/page/home.tag @@ -33,7 +33,7 @@ document.remove-event-listener 'visibilitychange' @window-on-visibilitychange on-stream-post(post) { - if document.hidden and post.user_id !== @I.id + if document.hidden and post.user_id !== this.I.id @unread-count++ document.title = '(' + @unread-count + ') ' + @get-post-summary post