parent
aaaaf2681a
commit
bceb02d760
15 changed files with 139 additions and 11 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue