User blocking (Following part) (#3035)
* block wip * UndoBlock * UnBlock * wip * follow * UI * fix
This commit is contained in:
parent
bcb0588409
commit
d64dc45899
17 changed files with 537 additions and 4 deletions
|
|
@ -5,8 +5,24 @@ import pack from '../../../remote/activitypub/renderer';
|
|||
import renderFollow from '../../../remote/activitypub/renderer/follow';
|
||||
import { deliver } from '../../../queue';
|
||||
import FollowRequest from '../../../models/follow-request';
|
||||
import Blocking from '../../../models/blocking';
|
||||
|
||||
export default async function(follower: IUser, followee: IUser, requestId?: string) {
|
||||
// check blocking
|
||||
const [ blocking, blocked ] = await Promise.all([
|
||||
Blocking.findOne({
|
||||
blockerId: follower._id,
|
||||
blockeeId: followee._id,
|
||||
}),
|
||||
Blocking.findOne({
|
||||
blockerId: followee._id,
|
||||
blockeeId: follower._id,
|
||||
})
|
||||
]);
|
||||
|
||||
if (blocking != null) throw new Error('blocking');
|
||||
if (blocked != null) throw new Error('blocked');
|
||||
|
||||
await FollowRequest.insert({
|
||||
createdAt: new Date(),
|
||||
followerId: follower._id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue