mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 19:03:08 +02:00
Implement visibility param
This commit is contained in:
parent
ec629c4d8d
commit
172f11a2a0
1 changed files with 5 additions and 0 deletions
|
@ -23,6 +23,10 @@ import distribute from '../../../../post/distribute';
|
||||||
* @return {Promise<any>}
|
* @return {Promise<any>}
|
||||||
*/
|
*/
|
||||||
module.exports = (params, user: ILocalUser, app) => new Promise(async (res, rej) => {
|
module.exports = (params, user: ILocalUser, app) => new Promise(async (res, rej) => {
|
||||||
|
// Get 'visibility' parameter
|
||||||
|
const [visibility = 'public', visibilityErr] = $(params.visibility).optional.string().or(['public', 'unlisted', 'private', 'direct']).$;
|
||||||
|
if (visibilityErr) return rej('invalid visibility');
|
||||||
|
|
||||||
// Get 'text' parameter
|
// Get 'text' parameter
|
||||||
const [text, textErr] = $(params.text).optional.string().pipe(isValidText).$;
|
const [text, textErr] = $(params.text).optional.string().pipe(isValidText).$;
|
||||||
if (textErr) return rej('invalid text');
|
if (textErr) return rej('invalid text');
|
||||||
|
@ -280,6 +284,7 @@ module.exports = (params, user: ILocalUser, app) => new Promise(async (res, rej)
|
||||||
userId: user._id,
|
userId: user._id,
|
||||||
appId: app ? app._id : null,
|
appId: app ? app._id : null,
|
||||||
viaMobile: viaMobile,
|
viaMobile: viaMobile,
|
||||||
|
visibility,
|
||||||
geo
|
geo
|
||||||
}, reply, repost, atMentions);
|
}, reply, repost, atMentions);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue