summaryrefslogtreecommitdiff
path: root/src/web/app/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-02-20 10:04:11 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-02-20 10:04:11 +0900
commit3c3040783f9f52f7e8a8e37a25cff7f97ef1ecd2 (patch)
tree512fa0c27d4afc60a9ce7e21ecdf95e2ce1f079b /src/web/app/common
parentwip (diff)
downloadmisskey-3c3040783f9f52f7e8a8e37a25cff7f97ef1ecd2.tar.gz
misskey-3c3040783f9f52f7e8a8e37a25cff7f97ef1ecd2.tar.bz2
misskey-3c3040783f9f52f7e8a8e37a25cff7f97ef1ecd2.zip
wip
Diffstat (limited to 'src/web/app/common')
-rw-r--r--src/web/app/common/tags/file-type-icon.tag2
-rw-r--r--src/web/app/common/tags/messaging/form.tag25
-rw-r--r--src/web/app/common/tags/messaging/index.tag34
-rw-r--r--src/web/app/common/tags/messaging/message.tag2
-rw-r--r--src/web/app/common/tags/messaging/room.tag8
-rw-r--r--src/web/app/common/tags/uploader.tag2
6 files changed, 37 insertions, 36 deletions
diff --git a/src/web/app/common/tags/file-type-icon.tag b/src/web/app/common/tags/file-type-icon.tag
index c484a57498..55c473bcd4 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
</style>
<script>
- this.kind = this.opts.type.split '/' .0
+ this.kind = this.opts.type.split('/')[0];
</script>
</mk-file-type-icon>
diff --git a/src/web/app/common/tags/messaging/form.tag b/src/web/app/common/tags/messaging/form.tag
index 649c16a25d..4ae1706ff1 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();
+ }
</script>
</mk-messaging-form>
diff --git a/src/web/app/common/tags/messaging/index.tag b/src/web/app/common/tags/messaging/index.tag
index f9ce48641f..d49596c870 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 a43991e0ec..96b4e8dafd 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 a571b330cb..320af8a8b4 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 2cf1aa324f..72f6eaa224 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?