summaryrefslogtreecommitdiff
path: root/src/services/note/create.ts
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2018-11-16 05:47:29 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2018-11-16 05:47:29 +0900
commitbceb02d760f53877f0f677144bc468ffbc4e66f2 (patch)
treecc12d9836b81deecead9417c8fd6df635784fefd /src/services/note/create.ts
parent[Client] Add missing icon (diff)
downloadsharkey-bceb02d760f53877f0f677144bc468ffbc4e66f2.tar.gz
sharkey-bceb02d760f53877f0f677144bc468ffbc4e66f2.tar.bz2
sharkey-bceb02d760f53877f0f677144bc468ffbc4e66f2.zip
local only visibility (#3254)
* local only visibility * fix UI
Diffstat (limited to 'src/services/note/create.ts')
-rw-r--r--src/services/note/create.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/services/note/create.ts b/src/services/note/create.ts
index 53d51036b3..0fd983d6c2 100644
--- a/src/services/note/create.ts
+++ b/src/services/note/create.ts
@@ -95,6 +95,7 @@ type Option = {
geo?: any;
poll?: any;
viaMobile?: boolean;
+ localOnly?: boolean;
cw?: string;
visibility?: string;
visibleUsers?: IUser[];
@@ -109,6 +110,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
if (data.createdAt == null) data.createdAt = new Date();
if (data.visibility == null) data.visibility = 'public';
if (data.viaMobile == null) data.viaMobile = false;
+ if (data.localOnly == null) data.localOnly = false;
if (data.visibleUsers) {
data.visibleUsers = erase(null, data.visibleUsers);
@@ -139,6 +141,16 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
return rej('Renote target is private of others');
}
+ // ローカルのみをRenoteしたらローカルのみにする
+ if (data.renote && data.renote.localOnly) {
+ data.localOnly = true;
+ }
+
+ // ローカルのみにリプライしたらローカルのみにする
+ if (data.reply && data.reply.localOnly) {
+ data.localOnly = true;
+ }
+
if (data.text) {
data.text = data.text.trim();
}
@@ -308,6 +320,8 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
});
async function renderActivity(data: Option, note: INote) {
+ if (data.localOnly) return null;
+
const content = data.renote && data.text == null && data.poll == null && (data.files == null || data.files.length == 0)
? renderAnnounce(data.renote.uri ? data.renote.uri : `${config.url}/notes/${data.renote._id}`, note)
: renderCreate(await renderNote(note, false), note);
@@ -389,6 +403,7 @@ async function insertNote(user: IUser, data: Option, tags: string[], emojis: str
emojis,
userId: user._id,
viaMobile: data.viaMobile,
+ localOnly: data.localOnly,
geo: data.geo || null,
appId: data.app ? data.app._id : null,
visibility: data.visibility,