This commit is contained in:
parent
4e6dcd16ac
commit
83d9730d93
33 changed files with 189 additions and 242 deletions
|
|
@ -13,7 +13,7 @@ import * as sharp from 'sharp';
|
|||
import DriveFile, { IMetadata, getDriveFileBucket, IDriveFile } from '../../models/drive-file';
|
||||
import DriveFolder from '../../models/drive-folder';
|
||||
import { pack } from '../../models/drive-file';
|
||||
import event, { publishDriveStream } from '../../stream';
|
||||
import { publishUserStream, publishDriveStream } from '../../stream';
|
||||
import { isLocalUser, IUser, IRemoteUser } from '../../models/user';
|
||||
import delFile from './delete-file';
|
||||
import config from '../../config';
|
||||
|
|
@ -309,7 +309,7 @@ export default async function(
|
|||
|
||||
pack(driveFile).then(packedFile => {
|
||||
// Publish drive_file_created event
|
||||
event(user._id, 'drive_file_created', packedFile);
|
||||
publishUserStream(user._id, 'drive_file_created', packedFile);
|
||||
publishDriveStream(user._id, 'file_created', packedFile);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import User, { isLocalUser, isRemoteUser, pack as packUser, IUser } from '../../
|
|||
import Following from '../../models/following';
|
||||
import FollowingLog from '../../models/following-log';
|
||||
import FollowedLog from '../../models/followed-log';
|
||||
import event from '../../stream';
|
||||
import { publishUserStream } from '../../stream';
|
||||
import notify from '../../notify';
|
||||
import pack from '../../remote/activitypub/renderer';
|
||||
import renderFollow from '../../remote/activitypub/renderer/follow';
|
||||
|
|
@ -61,12 +61,12 @@ export default async function(follower: IUser, followee: IUser) {
|
|||
|
||||
// Publish follow event
|
||||
if (isLocalUser(follower)) {
|
||||
packUser(followee, follower).then(packed => event(follower._id, 'follow', packed));
|
||||
packUser(followee, follower).then(packed => publishUserStream(follower._id, 'follow', packed));
|
||||
}
|
||||
|
||||
// Publish followed event
|
||||
if (isLocalUser(followee)) {
|
||||
packUser(follower, followee).then(packed => event(followee._id, 'followed', packed)),
|
||||
packUser(follower, followee).then(packed => publishUserStream(followee._id, 'followed', packed)),
|
||||
|
||||
// 通知を作成
|
||||
notify(followee._id, follower._id, 'follow');
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import User, { isLocalUser, isRemoteUser, pack as packUser, IUser } from '../../
|
|||
import Following from '../../models/following';
|
||||
import FollowingLog from '../../models/following-log';
|
||||
import FollowedLog from '../../models/followed-log';
|
||||
import event from '../../stream';
|
||||
import { publishUserStream } from '../../stream';
|
||||
import pack from '../../remote/activitypub/renderer';
|
||||
import renderFollow from '../../remote/activitypub/renderer/follow';
|
||||
import renderUndo from '../../remote/activitypub/renderer/undo';
|
||||
|
|
@ -52,7 +52,7 @@ export default async function(follower: IUser, followee: IUser) {
|
|||
|
||||
// Publish unfollow event
|
||||
if (isLocalUser(follower)) {
|
||||
packUser(followee, follower).then(packed => event(follower._id, 'unfollow', packed));
|
||||
packUser(followee, follower).then(packed => publishUserStream(follower._id, 'unfollow', packed));
|
||||
}
|
||||
|
||||
if (isLocalUser(follower) && isRemoteUser(followee)) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { deliver } from '../../../queue';
|
|||
import Following from '../../../models/following';
|
||||
import FollowingLog from '../../../models/following-log';
|
||||
import FollowedLog from '../../../models/followed-log';
|
||||
import event from '../../../stream';
|
||||
import { publishUserStream } from '../../../stream';
|
||||
|
||||
export default async function(followee: IUser, follower: IUser) {
|
||||
const following = await Following.insert({
|
||||
|
|
@ -74,5 +74,5 @@ export default async function(followee: IUser, follower: IUser) {
|
|||
|
||||
packUser(followee, followee, {
|
||||
detail: true
|
||||
}).then(packed => event(followee._id, 'meUpdated', packed));
|
||||
}).then(packed => publishUserStream(followee._id, 'meUpdated', packed));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,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 event from '../../../stream';
|
||||
import { publishUserStream } from '../../../stream';
|
||||
|
||||
export default async function(followee: IUser, follower: IUser) {
|
||||
if (isRemoteUser(followee)) {
|
||||
|
|
@ -25,5 +25,5 @@ export default async function(followee: IUser, follower: IUser) {
|
|||
|
||||
packUser(followee, followee, {
|
||||
detail: true
|
||||
}).then(packed => event(followee._id, 'meUpdated', packed));
|
||||
}).then(packed => publishUserStream(followee._id, 'meUpdated', packed));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import User, { isLocalUser, isRemoteUser, pack as packUser, IUser } from '../../../models/user';
|
||||
import event from '../../../stream';
|
||||
import { publishUserStream } from '../../../stream';
|
||||
import notify from '../../../notify';
|
||||
import pack from '../../../remote/activitypub/renderer';
|
||||
import renderFollow from '../../../remote/activitypub/renderer/follow';
|
||||
|
|
@ -35,11 +35,11 @@ export default async function(follower: IUser, followee: IUser) {
|
|||
|
||||
// Publish receiveRequest event
|
||||
if (isLocalUser(followee)) {
|
||||
packUser(follower, followee).then(packed => event(followee._id, 'receiveFollowRequest', packed));
|
||||
packUser(follower, followee).then(packed => publishUserStream(followee._id, 'receiveFollowRequest', packed));
|
||||
|
||||
packUser(followee, followee, {
|
||||
detail: true
|
||||
}).then(packed => event(followee._id, 'meUpdated', packed));
|
||||
}).then(packed => publishUserStream(followee._id, 'meUpdated', packed));
|
||||
|
||||
// 通知を作成
|
||||
notify(followee._id, follower._id, 'receiveFollowRequest');
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import es from '../../db/elasticsearch';
|
||||
import Note, { pack, INote } from '../../models/note';
|
||||
import User, { isLocalUser, IUser, isRemoteUser, IRemoteUser, ILocalUser } from '../../models/user';
|
||||
import stream, { publishLocalTimelineStream, publishHybridTimelineStream, publishGlobalTimelineStream, publishUserListStream } from '../../stream';
|
||||
import { publishUserStream, publishLocalTimelineStream, publishHybridTimelineStream, publishGlobalTimelineStream, publishUserListStream } from '../../stream';
|
||||
import Following from '../../models/following';
|
||||
import { deliver } from '../../queue';
|
||||
import renderNote from '../../remote/activitypub/renderer/note';
|
||||
|
|
@ -13,7 +13,6 @@ import notify from '../../notify';
|
|||
import NoteWatching from '../../models/note-watching';
|
||||
import watch from './watch';
|
||||
import Mute from '../../models/mute';
|
||||
import event from '../../stream';
|
||||
import parse from '../../mfm/parse';
|
||||
import { IApp } from '../../models/app';
|
||||
import UserList from '../../models/user-list';
|
||||
|
|
@ -189,7 +188,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
|
|||
} else {
|
||||
// Publish event
|
||||
if (!user._id.equals(data.renote.userId)) {
|
||||
event(data.renote.userId, 'renote', noteObj);
|
||||
publishUserStream(data.renote.userId, 'renote', noteObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -236,12 +235,12 @@ async function publish(user: IUser, note: INote, noteObj: any, reply: INote, ren
|
|||
|
||||
if (['private', 'followers', 'specified'].includes(note.visibility)) {
|
||||
// Publish event to myself's stream
|
||||
stream(note.userId, 'note', await pack(note, user, {
|
||||
publishUserStream(note.userId, 'note', await pack(note, user, {
|
||||
detail: true
|
||||
}));
|
||||
} else {
|
||||
// Publish event to myself's stream
|
||||
stream(note.userId, 'note', noteObj);
|
||||
publishUserStream(note.userId, 'note', noteObj);
|
||||
|
||||
// Publish note to local and hybrid timeline stream
|
||||
if (note.visibility != 'home') {
|
||||
|
|
@ -264,7 +263,7 @@ async function publish(user: IUser, note: INote, noteObj: any, reply: INote, ren
|
|||
const n = await pack(note, u, {
|
||||
detail: true
|
||||
});
|
||||
stream(u._id, 'note', n);
|
||||
publishUserStream(u._id, 'note', n);
|
||||
publishHybridTimelineStream(u._id, n);
|
||||
});
|
||||
}
|
||||
|
|
@ -417,7 +416,7 @@ async function publishToFollowers(note: INote, noteObj: any, user: IUser, noteAc
|
|||
}
|
||||
|
||||
// Publish event to followers stream
|
||||
stream(following.followerId, 'note', noteObj);
|
||||
publishUserStream(following.followerId, 'note', noteObj);
|
||||
|
||||
if (isRemoteUser(user) || note.visibility != 'public') {
|
||||
publishHybridTimelineStream(following.followerId, noteObj);
|
||||
|
|
@ -444,7 +443,7 @@ function deliverNoteToMentionedRemoteUsers(mentionedUsers: IUser[], user: ILocal
|
|||
|
||||
function createMentionedEvents(mentionedUsers: IUser[], noteObj: any, nm: NotificationManager) {
|
||||
mentionedUsers.filter(u => isLocalUser(u)).forEach(async (u) => {
|
||||
event(u, 'mention', noteObj);
|
||||
publishUserStream(u._id, 'mention', noteObj);
|
||||
|
||||
// Create notification
|
||||
nm.push(u._id, 'mention');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue