diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2018-11-16 05:47:29 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2018-11-16 05:47:29 +0900 |
| commit | bceb02d760f53877f0f677144bc468ffbc4e66f2 (patch) | |
| tree | cc12d9836b81deecead9417c8fd6df635784fefd /src/server | |
| parent | [Client] Add missing icon (diff) | |
| download | sharkey-bceb02d760f53877f0f677144bc468ffbc4e66f2.tar.gz sharkey-bceb02d760f53877f0f677144bc468ffbc4e66f2.tar.bz2 sharkey-bceb02d760f53877f0f677144bc468ffbc4e66f2.zip | |
local only visibility (#3254)
* local only visibility
* fix UI
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/activitypub.ts | 6 | ||||
| -rw-r--r-- | src/server/activitypub/outbox.ts | 3 | ||||
| -rw-r--r-- | src/server/api/endpoints/notes/create.ts | 9 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/server/activitypub.ts b/src/server/activitypub.ts index 8da933a0f6..888feb08ce 100644 --- a/src/server/activitypub.ts +++ b/src/server/activitypub.ts @@ -66,7 +66,8 @@ router.get('/notes/:note', async (ctx, next) => { const note = await Note.findOne({ _id: new mongo.ObjectID(ctx.params.note), - visibility: { $in: ['public', 'home'] } + visibility: { $in: ['public', 'home'] }, + localOnly: { $ne: true } }); if (note === null) { @@ -83,7 +84,8 @@ router.get('/notes/:note', async (ctx, next) => { router.get('/notes/:note/activity', async ctx => { const note = await Note.findOne({ _id: new mongo.ObjectID(ctx.params.note), - visibility: { $in: ['public', 'home'] } + visibility: { $in: ['public', 'home'] }, + localOnly: { $ne: true } }); if (note === null) { diff --git a/src/server/activitypub/outbox.ts b/src/server/activitypub/outbox.ts index 24d4e3730e..6b917ef843 100644 --- a/src/server/activitypub/outbox.ts +++ b/src/server/activitypub/outbox.ts @@ -55,7 +55,8 @@ export default async (ctx: Router.IRouterContext) => { const query = { userId: user._id, - visibility: { $in: ['public', 'home'] } + visibility: { $in: ['public', 'home'] }, + localOnly: { $ne: true } } as any; if (sinceId) { diff --git a/src/server/api/endpoints/notes/create.ts b/src/server/api/endpoints/notes/create.ts index a7050e2ec2..4f8d6a4f4f 100644 --- a/src/server/api/endpoints/notes/create.ts +++ b/src/server/api/endpoints/notes/create.ts @@ -74,6 +74,14 @@ export const meta = { } }, + localOnly: { + validator: $.bool.optional, + default: false, + desc: { + 'ja-JP': 'ローカルのみに投稿か否か。' + } + }, + geo: { validator: $.obj({ coordinates: $.arr().length(2) @@ -226,6 +234,7 @@ export default define(meta, (ps, user, app) => new Promise(async (res, rej) => { cw: ps.cw, app, viaMobile: ps.viaMobile, + localOnly: ps.localOnly, visibility: ps.visibility, visibleUsers, geo: ps.geo |