-
{ p.channel.title }:
+
{ p.channel.title }:
diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag
index fb8cbcdbd..b2d96f6b8 100644
--- a/src/web/app/mobile/tags/ui.tag
+++ b/src/web/app/mobile/tags/ui.tag
@@ -231,10 +231,11 @@
%i18n:mobile.tags.mk-ui-nav.messaging%
- %i18n:mobile.tags.mk-ui-nav.settings%
diff --git a/webpack/webpack.config.ts b/webpack/webpack.config.ts
index 5199285d5..066df1815 100644
--- a/webpack/webpack.config.ts
+++ b/webpack/webpack.config.ts
@@ -16,6 +16,7 @@ module.exports = langs.map(([lang, locale]) => {
const entry = {
desktop: './src/web/app/desktop/script.js',
mobile: './src/web/app/mobile/script.js',
+ ch: './src/web/app/ch/script.js',
stats: './src/web/app/stats/script.js',
status: './src/web/app/status/script.js',
dev: './src/web/app/dev/script.js',
From bc529801122986b80266efe454f9bddc3431a389 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 03:31:36 +0900
Subject: [PATCH 033/111] wip
---
src/web/app/ch/tags/channel.tag | 2 +-
src/web/app/mobile/router.js | 5 ++
src/web/app/mobile/tags/drive.tag | 6 +-
src/web/app/mobile/tags/index.js | 1 +
src/web/app/mobile/tags/page/selectdrive.tag | 83 ++++++++++++++++++++
5 files changed, 95 insertions(+), 2 deletions(-)
create mode 100644 src/web/app/mobile/tags/page/selectdrive.tag
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index b16844b8b..d43113a55 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -11,7 +11,7 @@
+
+
From 1dca32e84d2006081c9ca2b1d7c7d943ccabc814 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 03:41:34 +0900
Subject: [PATCH 034/111] wip
---
locales/en.yml | 3 +++
locales/ja.yml | 3 +++
src/web/app/ch/tags/channel.tag | 24 +++++++++++++++++++++---
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/locales/en.yml b/locales/en.yml
index 643649b46..afb6d2f2f 100644
--- a/locales/en.yml
+++ b/locales/en.yml
@@ -360,6 +360,9 @@ desktop:
mobile:
tags:
+ mk-selectdrive-page:
+ select-file: "Select file(s)"
+
mk-drive-file-viewer:
download: "Download"
rename: "Rename"
diff --git a/locales/ja.yml b/locales/ja.yml
index 9fd7d94f0..03975556b 100644
--- a/locales/ja.yml
+++ b/locales/ja.yml
@@ -360,6 +360,9 @@ desktop:
mobile:
tags:
+ mk-selectdrive-page:
+ select-file: "ファイルを選択"
+
mk-drive-file-viewer:
download: "ダウンロード"
rename: "名前を変更"
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index d43113a55..e8537e3f0 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -1,9 +1,13 @@
{ channel.title }
-
-
-
+ 読み込み中
+
@@ -33,6 +37,7 @@
this.id = this.opts.id;
this.fetching = true;
+ this.postsFetching = true;
this.channel = null;
this.posts = null;
this.connection = new ChannelStream(this.id);
@@ -60,6 +65,7 @@
channel_id: this.id
}).then(posts => {
this.update({
+ postsFetching: false,
posts: posts
});
});
@@ -84,6 +90,7 @@
@@ -114,6 +121,17 @@
> mk-time
margin-right 0.5em
+ &:first-of-type
+ display none
+
+ @media (max-width 600px)
+ > mk-time
+ &:first-of-type
+ display initial
+
+ &:last-of-type
+ display none
+
> div
padding 0 0 1em 2em
From 5fae9a89252387ebe42a6f70790351ca2ac9f55b Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 03:42:50 +0900
Subject: [PATCH 035/111] wip
---
src/web/app/ch/tags/channel.tag | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index e8537e3f0..43a1f851f 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -3,7 +3,7 @@
{ channel.title }
読み込み中
-
>
+
まだ投稿がありません
From 250875e248b03fc74638bd6f15a24cd37897c4d3 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 04:11:56 +0900
Subject: [PATCH 036/111] wip
---
src/api/endpoints.ts | 3 ++
src/api/endpoints/channels.ts | 59 +++++++++++++++++++++++++++++++++
src/web/app/ch/tags/channel.tag | 7 ++--
src/web/app/ch/tags/index.tag | 13 ++++++--
4 files changed, 77 insertions(+), 5 deletions(-)
create mode 100644 src/api/endpoints/channels.ts
diff --git a/src/api/endpoints.ts b/src/api/endpoints.ts
index 88c01d4e7..c4dacad85 100644
--- a/src/api/endpoints.ts
+++ b/src/api/endpoints.ts
@@ -490,6 +490,9 @@ const endpoints: Endpoint[] = [
{
name: 'channels/posts'
},
+ {
+ name: 'channels'
+ },
];
export default endpoints;
diff --git a/src/api/endpoints/channels.ts b/src/api/endpoints/channels.ts
new file mode 100644
index 000000000..e10c94389
--- /dev/null
+++ b/src/api/endpoints/channels.ts
@@ -0,0 +1,59 @@
+/**
+ * Module dependencies
+ */
+import $ from 'cafy';
+import Channel from '../models/channel';
+import serialize from '../serializers/channel';
+
+/**
+ * Get all channels
+ *
+ * @param {any} params
+ * @param {any} me
+ * @return {Promise}
+ */
+module.exports = (params, me) => new Promise(async (res, rej) => {
+ // Get 'limit' parameter
+ const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
+ if (limitErr) return rej('invalid limit param');
+
+ // Get 'since_id' parameter
+ const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
+ if (sinceIdErr) return rej('invalid since_id param');
+
+ // Get 'max_id' parameter
+ const [maxId, maxIdErr] = $(params.max_id).optional.id().$;
+ if (maxIdErr) return rej('invalid max_id param');
+
+ // Check if both of since_id and max_id is specified
+ if (sinceId && maxId) {
+ return rej('cannot set since_id and max_id');
+ }
+
+ // Construct query
+ const sort = {
+ _id: -1
+ };
+ const query = {} as any;
+ if (sinceId) {
+ sort._id = 1;
+ query._id = {
+ $gt: sinceId
+ };
+ } else if (maxId) {
+ query._id = {
+ $lt: maxId
+ };
+ }
+
+ // Issue query
+ const channels = await Channel
+ .find(query, {
+ limit: limit,
+ sort: sort
+ });
+
+ // Serialize
+ res(await Promise.all(channels.map(async channel =>
+ await serialize(channel, me))));
+});
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index 43a1f851f..12a6b5a3b 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -1,4 +1,6 @@
+
+
{ channel.title }
読み込み中
@@ -21,10 +23,9 @@
diff --git a/src/web/app/ch/tags/index.tag b/src/web/app/ch/tags/index.tag
index 1c0a037c2..a64ddb6cc 100644
--- a/src/web/app/ch/tags/index.tag
+++ b/src/web/app/ch/tags/index.tag
@@ -1,5 +1,9 @@
-
+
+
+
From c73517b13581b4e5bb04a4b456afe501f4e7a98b Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 13:25:43 +0900
Subject: [PATCH 060/111] v2793
---
CHANGELOG.md | 4 ++++
package.json | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd8ecb57e..6a86e24c6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@ ChangeLog (Release Notes)
=========================
主に notable な changes を書いていきます
+2793 (2017/11/01)
+-----------------
+* なんか
+
2783 (2017/11/01)
-----------------
* なんか
diff --git a/package.json b/package.json
index eaafeb9fd..87db0c8e1 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo ",
- "version": "0.0.2783",
+ "version": "0.0.2793",
"license": "MIT",
"description": "A miniblog-based SNS",
"bugs": "https://github.com/syuilo/misskey/issues",
From c498d90b1b2216726383564875e758e00ceb4450 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 13:39:05 +0900
Subject: [PATCH 061/111] wip
---
src/api/endpoints/posts/create.ts | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts
index 360b5df0d..b3fbdf6fa 100644
--- a/src/api/endpoints/posts/create.ts
+++ b/src/api/endpoints/posts/create.ts
@@ -249,8 +249,11 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
}
}
- // Publish event to myself's stream
- event(user._id, 'post', postObj);
+ // TODO
+ if (!channel) {
+ // Publish event to myself's stream
+ event(user._id, 'post', postObj);
+ }
if (channel) {
// Increment channel index(posts count)
From b2a39694d5b3bb60cbf8c9331b8be25e6f80b5f8 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 16:42:15 +0900
Subject: [PATCH 062/111] =?UTF-8?q?=E3=81=84=E3=81=84=E6=84=9F=E3=81=98?=
=?UTF-8?q?=E3=81=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/web/app/ch/tags/channel.tag | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index 602b80bc1..fdc9ab4ce 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -182,12 +182,13 @@
>>{ reply.index } ({ reply.user.name }): [x]
-
+
+
- { name }
@@ -202,6 +203,19 @@
this.mixin('api');
this.channel = this.opts.channel;
+ this.files = null;
+
+ this.on('mount', () => {
+ this.refs.uploader.on('uploaded', file => {
+ this.update({
+ files: [file]
+ });
+ });
+ });
+
+ this.upload = file => {
+ this.refs.uploader.upload(file);
+ };
this.clearReply = () => {
this.update({
@@ -217,7 +231,7 @@
this.refs.text.value = '';
};
- this.post = e => {
+ this.post = () => {
this.update({
wait: true
});
@@ -250,5 +264,17 @@
};
window.open(CONFIG.url + '/selectdrive?multiple=true', '_blank');
};
+
+ this.onkeydown = e => {
+ if ((e.which == 10 || e.which == 13) && (e.ctrlKey || e.metaKey)) this.post();
+ };
+
+ this.onpaste = e => {
+ e.clipboardData.items.forEach(item => {
+ if (item.kind == 'file') {
+ this.upload(item.getAsFile());
+ }
+ });
+ };
From 56a9d2c35a56877a1f210242469d3733980ee62b Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 16:42:51 +0900
Subject: [PATCH 063/111] v2795
---
CHANGELOG.md | 4 ++++
package.json | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6a86e24c6..9b2f3d7c0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@ ChangeLog (Release Notes)
=========================
主に notable な changes を書いていきます
+2795 (2017/11/01)
+-----------------
+* いい感じに
+
2793 (2017/11/01)
-----------------
* なんか
diff --git a/package.json b/package.json
index 87db0c8e1..09e5a6239 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo ",
- "version": "0.0.2793",
+ "version": "0.0.2795",
"license": "MIT",
"description": "A miniblog-based SNS",
"bugs": "https://github.com/syuilo/misskey/issues",
From a5fea663f160d49b670e6097398a7adb22b25662 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 16:48:00 +0900
Subject: [PATCH 064/111] Better progress bar
---
src/web/app/ch/tags/channel.tag | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index fdc9ab4ce..c6921e1a5 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -51,10 +51,18 @@
Progress.start();
+ const fetched = false;
+
+ // チャンネル概要読み込み
this.api('channels/show', {
channel_id: this.id
}).then(channel => {
- Progress.done();
+ if (fetched) {
+ Progress.done();
+ } else {
+ Progress.set(0.5);
+ fetched = true;
+ }
this.update({
fetching: false,
@@ -64,9 +72,17 @@
document.title = channel.title + ' | Misskey'
});
+ // 投稿読み込み
this.api('channels/posts', {
channel_id: this.id
}).then(posts => {
+ if (fetched) {
+ Progress.done();
+ } else {
+ Progress.set(0.5);
+ fetched = true;
+ }
+
this.update({
postsFetching: false,
posts: posts
From 1cd75bfeb81261e49fbe6f6f4539615e337e9616 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 17:09:24 +0900
Subject: [PATCH 065/111] Fix bug
---
src/web/app/ch/tags/channel.tag | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index c6921e1a5..67b012cb5 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -51,7 +51,7 @@
Progress.start();
- const fetched = false;
+ let fetched = false;
// チャンネル概要読み込み
this.api('channels/show', {
From 24712b8031f37515982e25b1b0a82422e4f13028 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 17:20:54 +0900
Subject: [PATCH 066/111] :v:
---
src/web/app/ch/tags/channel.tag | 54 +++++++++++++++++++++++++++++----
1 file changed, 48 insertions(+), 6 deletions(-)
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index 67b012cb5..ad254c98e 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -3,12 +3,20 @@
{ channel.title }
- 読み込み中
-
-
まだ投稿がありません
-
-
-
+
+
+
+
+
+
+
@@ -29,6 +37,14 @@
> h1
font-size 1.5em
color #f00
+
+ > .share
+ > *
+ margin-right 4px
+
+ > .body
+ margin 8px 0 0 0
+
+
+
+
+
+
+
+
+
+
+
From 5631d4bd8f97a80296079aa7b15ee0f87425d3aa Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 17:21:26 +0900
Subject: [PATCH 067/111] v2799
---
CHANGELOG.md | 4 ++++
package.json | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b2f3d7c0..03282eb3c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@ ChangeLog (Release Notes)
=========================
主に notable な changes を書いていきます
+2799 (2017/11/01)
+-----------------
+* いい感じに
+
2795 (2017/11/01)
-----------------
* いい感じに
diff --git a/package.json b/package.json
index 09e5a6239..a45d3b36c 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo ",
- "version": "0.0.2795",
+ "version": "0.0.2799",
"license": "MIT",
"description": "A miniblog-based SNS",
"bugs": "https://github.com/syuilo/misskey/issues",
From 45945bdb9d5b7b58bddbe0de0736f53d8c7c6cb0 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 19:33:08 +0900
Subject: [PATCH 068/111] Implement Channel Watching
---
src/api/endpoints.ts | 8 ++++
src/api/endpoints/channels/create.ts | 11 ++++-
src/api/endpoints/channels/unwatch.ts | 60 +++++++++++++++++++++++++++
src/api/endpoints/channels/watch.ts | 58 ++++++++++++++++++++++++++
src/api/endpoints/posts/create.ts | 43 ++++++++++++-------
src/api/endpoints/posts/timeline.ts | 39 ++++++++++++-----
src/api/models/channel-watching.ts | 3 ++
src/api/serializers/channel.ts | 22 ++++++++++
src/web/app/ch/tags/channel.tag | 27 ++++++++++++
9 files changed, 244 insertions(+), 27 deletions(-)
create mode 100644 src/api/endpoints/channels/unwatch.ts
create mode 100644 src/api/endpoints/channels/watch.ts
create mode 100644 src/api/models/channel-watching.ts
diff --git a/src/api/endpoints.ts b/src/api/endpoints.ts
index c4dacad85..afefce39e 100644
--- a/src/api/endpoints.ts
+++ b/src/api/endpoints.ts
@@ -490,6 +490,14 @@ const endpoints: Endpoint[] = [
{
name: 'channels/posts'
},
+ {
+ name: 'channels/watch',
+ withCredential: true
+ },
+ {
+ name: 'channels/unwatch',
+ withCredential: true
+ },
{
name: 'channels'
},
diff --git a/src/api/endpoints/channels/create.ts b/src/api/endpoints/channels/create.ts
index e0c0e0192..a8d7c29dc 100644
--- a/src/api/endpoints/channels/create.ts
+++ b/src/api/endpoints/channels/create.ts
@@ -3,6 +3,7 @@
*/
import $ from 'cafy';
import Channel from '../../models/channel';
+import Watching from '../../models/channel-watching';
import serialize from '../../serializers/channel';
/**
@@ -22,9 +23,17 @@ module.exports = async (params, user) => new Promise(async (res, rej) => {
created_at: new Date(),
user_id: user._id,
title: title,
- index: 0
+ index: 0,
+ watching_count: 1
});
// Response
res(await serialize(channel));
+
+ // Create Watching
+ await Watching.insert({
+ created_at: new Date(),
+ user_id: user._id,
+ channel_id: channel._id
+ });
});
diff --git a/src/api/endpoints/channels/unwatch.ts b/src/api/endpoints/channels/unwatch.ts
new file mode 100644
index 000000000..19d3be118
--- /dev/null
+++ b/src/api/endpoints/channels/unwatch.ts
@@ -0,0 +1,60 @@
+/**
+ * Module dependencies
+ */
+import $ from 'cafy';
+import Channel from '../../models/channel';
+import Watching from '../../models/channel-watching';
+
+/**
+ * Unwatch a channel
+ *
+ * @param {any} params
+ * @param {any} user
+ * @return {Promise}
+ */
+module.exports = (params, user) => new Promise(async (res, rej) => {
+ // Get 'channel_id' parameter
+ const [channelId, channelIdErr] = $(params.channel_id).id().$;
+ if (channelIdErr) return rej('invalid channel_id param');
+
+ //#region Fetch channel
+ const channel = await Channel.findOne({
+ _id: channelId
+ });
+
+ if (channel === null) {
+ return rej('channel not found');
+ }
+ //#endregion
+
+ //#region Check whether not watching
+ const exist = await Watching.findOne({
+ user_id: user._id,
+ channel_id: channel._id,
+ deleted_at: { $exists: false }
+ });
+
+ if (exist === null) {
+ return rej('already not watching');
+ }
+ //#endregion
+
+ // Delete watching
+ await Watching.update({
+ _id: exist._id
+ }, {
+ $set: {
+ deleted_at: new Date()
+ }
+ });
+
+ // Send response
+ res();
+
+ // Decrement watching count
+ Channel.update(channel._id, {
+ $inc: {
+ watching_count: -1
+ }
+ });
+});
diff --git a/src/api/endpoints/channels/watch.ts b/src/api/endpoints/channels/watch.ts
new file mode 100644
index 000000000..030e0dd41
--- /dev/null
+++ b/src/api/endpoints/channels/watch.ts
@@ -0,0 +1,58 @@
+/**
+ * Module dependencies
+ */
+import $ from 'cafy';
+import Channel from '../../models/channel';
+import Watching from '../../models/channel-watching';
+
+/**
+ * Watch a channel
+ *
+ * @param {any} params
+ * @param {any} user
+ * @return {Promise}
+ */
+module.exports = (params, user) => new Promise(async (res, rej) => {
+ // Get 'channel_id' parameter
+ const [channelId, channelIdErr] = $(params.channel_id).id().$;
+ if (channelIdErr) return rej('invalid channel_id param');
+
+ //#region Fetch channel
+ const channel = await Channel.findOne({
+ _id: channelId
+ });
+
+ if (channel === null) {
+ return rej('channel not found');
+ }
+ //#endregion
+
+ //#region Check whether already watching
+ const exist = await Watching.findOne({
+ user_id: user._id,
+ channel_id: channel._id,
+ deleted_at: { $exists: false }
+ });
+
+ if (exist !== null) {
+ return rej('already watching');
+ }
+ //#endregion
+
+ // Create Watching
+ await Watching.insert({
+ created_at: new Date(),
+ user_id: user._id,
+ channel_id: channel._id
+ });
+
+ // Send response
+ res();
+
+ // Increment watching count
+ Channel.update(channel._id, {
+ $inc: {
+ watching_count: 1
+ }
+ });
+});
diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts
index b3fbdf6fa..2326f7baf 100644
--- a/src/api/endpoints/posts/create.ts
+++ b/src/api/endpoints/posts/create.ts
@@ -10,6 +10,7 @@ import { default as Channel, IChannel } from '../../models/channel';
import Following from '../../models/following';
import DriveFile from '../../models/drive-file';
import Watching from '../../models/post-watching';
+import ChannelWatching from '../../models/channel-watching';
import serialize from '../../serializers/post';
import notify from '../../common/notify';
import watch from '../../common/watch-post';
@@ -249,26 +250,11 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
}
}
- // TODO
+ // タイムラインへの投稿
if (!channel) {
// Publish event to myself's stream
event(user._id, 'post', postObj);
- }
- if (channel) {
- // Increment channel index(posts count)
- Channel.update({ _id: channel._id }, {
- $inc: {
- index: 1
- }
- });
-
- // Publish event to channel
- publishChannelStream(channel._id, 'post', postObj);
- }
-
- // TODO
- if (!channel) {
// Fetch all followers
const followers = await Following
.find({
@@ -285,6 +271,31 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
event(following.follower_id, 'post', postObj));
}
+ // チャンネルへの投稿
+ if (channel) {
+ // Increment channel index(posts count)
+ Channel.update({ _id: channel._id }, {
+ $inc: {
+ index: 1
+ }
+ });
+
+ // Publish event to channel
+ publishChannelStream(channel._id, 'post', postObj);
+
+ // Get channel watchers
+ const watches = await ChannelWatching.find({
+ channel_id: channel._id,
+ // 削除されたドキュメントは除く
+ deleted_at: { $exists: false }
+ });
+
+ // チャンネルの視聴者(のタイムライン)に配信
+ watches.forEach(w => {
+ event(w.user_id, 'post', postObj);
+ });
+ }
+
// Increment my posts count
User.update({ _id: user._id }, {
$inc: {
diff --git a/src/api/endpoints/posts/timeline.ts b/src/api/endpoints/posts/timeline.ts
index fe096442b..aa5aff5ba 100644
--- a/src/api/endpoints/posts/timeline.ts
+++ b/src/api/endpoints/posts/timeline.ts
@@ -3,6 +3,7 @@
*/
import $ from 'cafy';
import Post from '../../models/post';
+import ChannelWatching from '../../models/channel-watching';
import getFriends from '../../common/get-friends';
import serialize from '../../serializers/post';
@@ -32,26 +33,43 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
return rej('cannot set since_id and max_id');
}
- // ID list of the user $self and other users who the user follows
+ // ID list of the user itself and other users who the user follows
const followingIds = await getFriends(user._id);
- // Construct query
+ // Watchしているチャンネルを取得
+ const watches = await ChannelWatching.find({
+ user_id: user._id,
+ // 削除されたドキュメントは除く
+ deleted_at: { $exists: false }
+ });
+
+ //#region Construct query
const sort = {
_id: -1
};
+
const query = {
- user_id: {
- $in: followingIds
- },
- // TODO
$or: [{
- channel_id: {
- $exists: false
- }
+ // フォローしている人のタイムラインへの投稿
+ user_id: {
+ $in: followingIds
+ },
+ // 「タイムラインへの」投稿に限定するためにチャンネルが指定されていないもののみに限る
+ $or: [{
+ channel_id: {
+ $exists: false
+ }
+ }, {
+ channel_id: null
+ }]
}, {
- channel_id: null
+ // Watchしているチャンネルへの投稿
+ channel_id: {
+ $in: watches.map(w => w.channel_id)
+ }
}]
} as any;
+
if (sinceId) {
sort._id = 1;
query._id = {
@@ -62,6 +80,7 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
$lt: maxId
};
}
+ //#endregion
// Issue query
const timeline = await Post
diff --git a/src/api/models/channel-watching.ts b/src/api/models/channel-watching.ts
new file mode 100644
index 000000000..6184ae408
--- /dev/null
+++ b/src/api/models/channel-watching.ts
@@ -0,0 +1,3 @@
+import db from '../../db/mongodb';
+
+export default db.get('channel_watching') as any; // fuck type definition
diff --git a/src/api/serializers/channel.ts b/src/api/serializers/channel.ts
index d4e16d6be..3cba39aa1 100644
--- a/src/api/serializers/channel.ts
+++ b/src/api/serializers/channel.ts
@@ -5,6 +5,7 @@ import * as mongo from 'mongodb';
import deepcopy = require('deepcopy');
import { IUser } from '../models/user';
import { default as Channel, IChannel } from '../models/channel';
+import Watching from '../models/channel-watching';
/**
* Serialize a channel
@@ -40,5 +41,26 @@ export default (
// Remove needless properties
delete _channel.user_id;
+ // Me
+ const meId: mongo.ObjectID = me
+ ? mongo.ObjectID.prototype.isPrototypeOf(me)
+ ? me as mongo.ObjectID
+ : typeof me === 'string'
+ ? new mongo.ObjectID(me)
+ : (me as IUser)._id
+ : null;
+
+ if (me) {
+ //#region Watchしているかどうか
+ const watch = await Watching.findOne({
+ user_id: meId,
+ channel_id: _channel.id,
+ deleted_at: { $exists: false }
+ });
+
+ _channel.is_watching = watch !== null;
+ //#endregion
+ }
+
resolve(_channel);
});
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index ad254c98e..57cedf10d 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -4,6 +4,11 @@
{ channel.title }
+
+
@@ -131,6 +136,28 @@
document.title = this.channel.title + ' | Misskey'
}
};
+
+ this.watch = () => {
+ this.api('channels/watch', {
+ channel_id: this.id
+ }).then(() => {
+ this.channel.is_watching = true;
+ this.update();
+ }, e => {
+ alert('error');
+ });
+ };
+
+ this.unwatch = () => {
+ this.api('channels/unwatch', {
+ channel_id: this.id
+ }).then(() => {
+ this.channel.is_watching = false;
+ this.update();
+ }, e => {
+ alert('error');
+ });
+ };
From 66bc0d8d272a15d75b8314d226e3b80932b8dc17 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Wed, 1 Nov 2017 19:33:14 +0900
Subject: [PATCH 069/111] v2801
---
CHANGELOG.md | 4 ++++
package.json | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 03282eb3c..554e12093 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@ ChangeLog (Release Notes)
=========================
主に notable な changes を書いていきます
+2801 (2017/11/01)
+-----------------
+* チャンネルのWatch実装
+
2799 (2017/11/01)
-----------------
* いい感じに
diff --git a/package.json b/package.json
index a45d3b36c..b6bf0cec7 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo ",
- "version": "0.0.2799",
+ "version": "0.0.2801",
"license": "MIT",
"description": "A miniblog-based SNS",
"bugs": "https://github.com/syuilo/misskey/issues",
From 0d9fed7c655c7f683a4db90e35e675b74c5d1ef3 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Thu, 2 Nov 2017 00:02:03 +0900
Subject: [PATCH 070/111] Improve usability
---
src/web/app/ch/tags/channel.tag | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index 57cedf10d..4c1e66963 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -321,7 +321,10 @@
files: files
});
};
- window.open(CONFIG.url + '/selectdrive?multiple=true', '_blank');
+
+ window.open(CONFIG.url + '/selectdrive?multiple=true',
+ 'drive_window',
+ 'height=500,width=800');
};
this.onkeydown = e => {
From a6fd8747e502f7787d3f94aba02ccea78daeeff3 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Thu, 2 Nov 2017 00:04:39 +0900
Subject: [PATCH 071/111] Fix bug
---
src/web/app/ch/tags/channel.tag | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index 4c1e66963..85560e7b7 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -17,7 +17,7 @@
読み込み中
-
まだ投稿がありません
+
まだ投稿がありません
From 96e3ec7674cf9a7993ba35553e38acd78400c0e5 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Thu, 2 Nov 2017 00:20:33 +0900
Subject: [PATCH 072/111] :art:
---
src/web/app/ch/style.styl | 1 +
src/web/app/ch/tags/channel.tag | 3 +--
src/web/app/ch/tags/header.tag | 20 ++++++++++++++++++++
src/web/app/ch/tags/index.js | 1 +
src/web/app/ch/tags/index.tag | 2 ++
5 files changed, 25 insertions(+), 2 deletions(-)
create mode 100644 src/web/app/ch/tags/header.tag
diff --git a/src/web/app/ch/style.styl b/src/web/app/ch/style.styl
index 2fc3ac3fc..8ad6fbce0 100644
--- a/src/web/app/ch/style.styl
+++ b/src/web/app/ch/style.styl
@@ -1,4 +1,5 @@
@import "../base"
html
+ padding 8px
background #efefef
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index 85560e7b7..35463bc0b 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -1,5 +1,5 @@
-
+
{ channel.title }
@@ -36,7 +36,6 @@
+
+
diff --git a/src/web/app/ch/tags/index.js b/src/web/app/ch/tags/index.js
index 1e99ccd43..12ffdaeb8 100644
--- a/src/web/app/ch/tags/index.js
+++ b/src/web/app/ch/tags/index.js
@@ -1,2 +1,3 @@
require('./index.tag');
require('./channel.tag');
+require('./header.tag');
diff --git a/src/web/app/ch/tags/index.tag b/src/web/app/ch/tags/index.tag
index a64ddb6cc..50ccc0d91 100644
--- a/src/web/app/ch/tags/index.tag
+++ b/src/web/app/ch/tags/index.tag
@@ -1,4 +1,6 @@
+
+
From 2ef1a7117b28235b1663b81ec19442e46bcd3d67 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Thu, 2 Nov 2017 00:21:22 +0900
Subject: [PATCH 073/111] v2805
---
CHANGELOG.md | 4 ++++
package.json | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 554e12093..20323bd96 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@ ChangeLog (Release Notes)
=========================
主に notable な changes を書いていきます
+2805 (2017/11/02)
+-----------------
+* いい感じに
+
2801 (2017/11/01)
-----------------
* チャンネルのWatch実装
diff --git a/package.json b/package.json
index b6bf0cec7..9f04d3125 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo ",
- "version": "0.0.2801",
+ "version": "0.0.2805",
"license": "MIT",
"description": "A miniblog-based SNS",
"bugs": "https://github.com/syuilo/misskey/issues",
From cf9c8bdc45de3567cadd641c77e256a0893af7b8 Mon Sep 17 00:00:00 2001
From: syuilo
Date: Thu, 2 Nov 2017 12:39:19 +0900
Subject: [PATCH 074/111] :v:
---
locales/en.yml | 7 +++++
locales/ja.yml | 7 +++++
src/web/app/{base.styl => app.styl} | 8 +++--
src/web/app/auth/style.styl | 3 +-
src/web/app/ch/style.styl | 7 ++++-
src/web/app/ch/tags/channel.tag | 48 +++++++++++++++++++++++++----
src/web/app/desktop/style.styl | 3 +-
src/web/app/dev/style.styl | 3 +-
src/web/app/mobile/style.styl | 3 +-
src/web/app/reset.styl | 13 --------
src/web/app/stats/style.styl | 3 +-
src/web/app/status/style.styl | 3 +-
12 files changed, 80 insertions(+), 28 deletions(-)
rename src/web/app/{base.styl => app.styl} (94%)
diff --git a/locales/en.yml b/locales/en.yml
index cf75bee92..52e8dfdb4 100644
--- a/locales/en.yml
+++ b/locales/en.yml
@@ -170,6 +170,13 @@ ch:
new: "Create new channel"
channel-title: "Channel title"
+ mk-channel-form:
+ textarea: "Write here"
+ upload: "Upload"
+ drive: "Drive"
+ post: "Do"
+ posting: "Doing"
+
desktop:
tags:
mk-api-info:
diff --git a/locales/ja.yml b/locales/ja.yml
index 03975556b..3dae21d4a 100644
--- a/locales/ja.yml
+++ b/locales/ja.yml
@@ -170,6 +170,13 @@ ch:
new: "チャンネルを作成"
channel-title: "チャンネルのタイトル"
+ mk-channel-form:
+ textarea: "書いて"
+ upload: "アップロード"
+ drive: "ドライブ"
+ post: "やる"
+ posting: "やってます"
+
desktop:
tags:
mk-api-info:
diff --git a/src/web/app/base.styl b/src/web/app/app.styl
similarity index 94%
rename from src/web/app/base.styl
rename to src/web/app/app.styl
index 81c039f0a..94faba73d 100644
--- a/src/web/app/base.styl
+++ b/src/web/app/app.styl
@@ -5,8 +5,6 @@ json('../../const.json')
$theme-color = themeColor
$theme-color-foreground = themeColorForeground
-@import './reset'
-
/*
::selection
background $theme-color
@@ -14,6 +12,9 @@ $theme-color-foreground = themeColorForeground
*/
*
+ position relative
+ box-sizing border-box
+ background-clip padding-box !important
tap-highlight-color rgba($theme-color, 0.7)
-webkit-tap-highlight-color rgba($theme-color, 0.7)
@@ -29,6 +30,9 @@ html
&, *
cursor progress !important
+body
+ overflow-wrap break-word
+
#error
padding 32px
color #fff
diff --git a/src/web/app/auth/style.styl b/src/web/app/auth/style.styl
index 046a5ff6e..bd25e1b57 100644
--- a/src/web/app/auth/style.styl
+++ b/src/web/app/auth/style.styl
@@ -1,4 +1,5 @@
-@import "../base"
+@import "../app"
+@import "../reset"
html
background #eee
diff --git a/src/web/app/ch/style.styl b/src/web/app/ch/style.styl
index 8ad6fbce0..21ca648cb 100644
--- a/src/web/app/ch/style.styl
+++ b/src/web/app/ch/style.styl
@@ -1,5 +1,10 @@
-@import "../base"
+@import "../app"
html
padding 8px
background #efefef
+
+#wait
+ top auto
+ bottom 15px
+ left 15px
diff --git a/src/web/app/ch/tags/channel.tag b/src/web/app/ch/tags/channel.tag
index 35463bc0b..4ae62e7b3 100644
--- a/src/web/app/ch/tags/channel.tag
+++ b/src/web/app/ch/tags/channel.tag
@@ -49,6 +49,9 @@
> .body
margin 8px 0 0 0
+ > mk-channel-form
+ max-width 500px
+