mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 13:23:09 +02:00
Hide invisible notes from timeline (#3852)
This commit is contained in:
parent
c417e2f4a1
commit
04e1e48f17
5 changed files with 85 additions and 8 deletions
|
@ -135,13 +135,30 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const visibleQuery = user == null ? [{
|
||||||
|
visibility: { $in: [ 'public', 'home' ] }
|
||||||
|
}] : [{
|
||||||
|
visibility: { $in: [ 'public', 'home' ] }
|
||||||
|
}, {
|
||||||
|
// myself (for specified/private)
|
||||||
|
userId: user._id
|
||||||
|
}, {
|
||||||
|
// to me (for specified)
|
||||||
|
visibleUserIds: { $in: [ user._id ] }
|
||||||
|
}];
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
$and: [{
|
$and: [{
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
|
|
||||||
$or: [{
|
$or: [{
|
||||||
// フォローしている人の投稿
|
$and: [{
|
||||||
$or: followQuery
|
// フォローしている人の投稿
|
||||||
|
$or: followQuery
|
||||||
|
}, {
|
||||||
|
// visible for me
|
||||||
|
$or: visibleQuery
|
||||||
|
}]
|
||||||
}, {
|
}, {
|
||||||
// public only
|
// public only
|
||||||
visibility: 'public',
|
visibility: 'public',
|
||||||
|
|
|
@ -103,6 +103,18 @@ export const meta = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
||||||
|
const visibleQuery = me == null ? [{
|
||||||
|
visibility: { $in: [ 'public', 'home' ] }
|
||||||
|
}] : [{
|
||||||
|
visibility: { $in: [ 'public', 'home' ] }
|
||||||
|
}, {
|
||||||
|
// myself (for specified/private)
|
||||||
|
userId: me._id
|
||||||
|
}, {
|
||||||
|
// to me (for specified)
|
||||||
|
visibleUserIds: { $in: [ me._id ] }
|
||||||
|
}];
|
||||||
|
|
||||||
const q: any = {
|
const q: any = {
|
||||||
$and: [ps.tag ? {
|
$and: [ps.tag ? {
|
||||||
tagsLower: ps.tag.toLowerCase()
|
tagsLower: ps.tag.toLowerCase()
|
||||||
|
@ -113,7 +125,8 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
||||||
}))
|
}))
|
||||||
}))
|
}))
|
||||||
}],
|
}],
|
||||||
deletedAt: { $exists: false }
|
deletedAt: { $exists: false },
|
||||||
|
$or: visibleQuery
|
||||||
};
|
};
|
||||||
|
|
||||||
const push = (x: any) => q.$and.push(x);
|
const push = (x: any) => q.$and.push(x);
|
||||||
|
|
|
@ -139,12 +139,29 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const visibleQuery = user == null ? [{
|
||||||
|
visibility: { $in: [ 'public', 'home' ] }
|
||||||
|
}] : [{
|
||||||
|
visibility: { $in: [ 'public', 'home' ] }
|
||||||
|
}, {
|
||||||
|
// myself (for specified/private)
|
||||||
|
userId: user._id
|
||||||
|
}, {
|
||||||
|
// to me (for specified)
|
||||||
|
visibleUserIds: { $in: [ user._id ] }
|
||||||
|
}];
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
$and: [{
|
$and: [{
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
|
|
||||||
// フォローしている人の投稿
|
$and: [{
|
||||||
$or: followQuery,
|
// フォローしている人の投稿
|
||||||
|
$or: followQuery
|
||||||
|
}, {
|
||||||
|
// visible for me
|
||||||
|
$or: visibleQuery
|
||||||
|
}],
|
||||||
|
|
||||||
// mute
|
// mute
|
||||||
userId: {
|
userId: {
|
||||||
|
|
|
@ -146,12 +146,29 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
||||||
}]
|
}]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const visibleQuery = user == null ? [{
|
||||||
|
visibility: { $in: [ 'public', 'home' ] }
|
||||||
|
}] : [{
|
||||||
|
visibility: { $in: [ 'public', 'home' ] }
|
||||||
|
}, {
|
||||||
|
// myself (for specified/private)
|
||||||
|
userId: user._id
|
||||||
|
}, {
|
||||||
|
// to me (for specified)
|
||||||
|
visibleUserIds: { $in: [ user._id ] }
|
||||||
|
}];
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
$and: [{
|
$and: [{
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
|
|
||||||
// リストに入っている人のタイムラインへの投稿
|
$and: [{
|
||||||
$or: listQuery,
|
// リストに入っている人のタイムラインへの投稿
|
||||||
|
$or: listQuery
|
||||||
|
}, {
|
||||||
|
// visible for me
|
||||||
|
$or: visibleQuery
|
||||||
|
}],
|
||||||
|
|
||||||
// mute
|
// mute
|
||||||
userId: {
|
userId: {
|
||||||
|
|
|
@ -155,10 +155,23 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
||||||
//#region Construct query
|
//#region Construct query
|
||||||
const sort = { } as any;
|
const sort = { } as any;
|
||||||
|
|
||||||
|
const visibleQuery = me == null ? [{
|
||||||
|
visibility: { $in: [ 'public', 'home' ] }
|
||||||
|
}] : [{
|
||||||
|
visibility: { $in: [ 'public', 'home' ] }
|
||||||
|
}, {
|
||||||
|
// myself (for specified/private)
|
||||||
|
userId: me._id
|
||||||
|
}, {
|
||||||
|
// to me (for specified)
|
||||||
|
visibleUserIds: { $in: [ me._id ] }
|
||||||
|
}];
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
$and: [ {} ],
|
$and: [ {} ],
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
userId: user._id
|
userId: user._id,
|
||||||
|
$or: visibleQuery
|
||||||
} as any;
|
} as any;
|
||||||
|
|
||||||
if (ps.sinceId) {
|
if (ps.sinceId) {
|
||||||
|
|
Loading…
Reference in a new issue