1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-27 22:38:34 +09:00
This commit is contained in:
syuilo 2018-10-22 17:13:06 +09:00
parent e2a79abbe0
commit e9a8090d7e
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
4 changed files with 13 additions and 13 deletions

View File

@ -7,7 +7,7 @@ import renderFollow from '../../remote/activitypub/renderer/follow';
import renderAccept from '../../remote/activitypub/renderer/accept';
import { deliver } from '../../queue';
import createFollowRequest from './requests/create';
import { followingStats } from '../stats';
import { perUserFollowingStats } from '../stats';
export default async function(follower: IUser, followee: IUser, requestId?: string) {
// フォロー対象が鍵アカウントである or
@ -53,7 +53,7 @@ export default async function(follower: IUser, followee: IUser, requestId?: stri
});
//#endregion
followingStats.update(follower, followee, true);
perUserFollowingStats.update(follower, followee, true);
// Publish follow event
if (isLocalUser(follower)) {

View File

@ -5,7 +5,7 @@ import pack from '../../remote/activitypub/renderer';
import renderFollow from '../../remote/activitypub/renderer/follow';
import renderUndo from '../../remote/activitypub/renderer/undo';
import { deliver } from '../../queue';
import { followingStats } from '../stats';
import { perUserFollowingStats } from '../stats';
export default async function(follower: IUser, followee: IUser) {
const following = await Following.findOne({
@ -38,7 +38,7 @@ export default async function(follower: IUser, followee: IUser) {
});
//#endregion
followingStats.update(follower, followee, false);
perUserFollowingStats.update(follower, followee, false);
// Publish unfollow event
if (isLocalUser(follower)) {

View File

@ -6,7 +6,7 @@ import renderAccept from '../../../remote/activitypub/renderer/accept';
import { deliver } from '../../../queue';
import Following from '../../../models/following';
import { publishMainStream } from '../../../stream';
import { followingStats } from '../../stats';
import { perUserFollowingStats } from '../../stats';
export default async function(followee: IUser, follower: IUser) {
await Following.insert({
@ -58,7 +58,7 @@ export default async function(followee: IUser, follower: IUser) {
});
//#endregion
followingStats.update(follower, followee, true);
perUserFollowingStats.update(follower, followee, true);
await User.update({ _id: followee._id }, {
$inc: {

View File

@ -694,11 +694,11 @@ class HashtagStats extends Stats<HashtagLog> {
export const hashtagStats = new HashtagStats();
//#endregion
//#region Following stats
//#region Per user following stats
/**
*
*/
type FollowingLog = {
type PerUserFollowingLog = {
local: {
/**
*
@ -741,16 +741,16 @@ type FollowingLog = {
};
};
remote: FollowingLog['local'];
remote: PerUserFollowingLog['local'];
};
class FollowingStats extends Stats<FollowingLog> {
class PerUserFollowingStats extends Stats<PerUserFollowingLog> {
constructor() {
super('following', true);
super('perUserFollowing', true);
}
@autobind
protected async getTemplate(init: boolean, latest?: FollowingLog, group?: any): Promise<FollowingLog> {
protected async getTemplate(init: boolean, latest?: PerUserFollowingLog, group?: any): Promise<PerUserFollowingLog> {
const [
localFollowingsCount,
localFollowersCount,
@ -817,7 +817,7 @@ class FollowingStats extends Stats<FollowingLog> {
}
}
export const followingStats = new FollowingStats();
export const perUserFollowingStats = new PerUserFollowingStats();
//#endregion
//#region Per user notes stats