1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-30 07:49:02 +09:00

Fix iroiro

This commit is contained in:
syuilo 2017-05-24 16:29:00 +09:00
parent 145ba241e2
commit 39edc11ad8
7 changed files with 22 additions and 15 deletions

View File

@ -6,7 +6,7 @@ module.exports = (text, i) => {
if (!(/^\s#[^\s]+/.test(text) || (i == 0 && /^#[^\s]+/.test(text)))) return null; if (!(/^\s#[^\s]+/.test(text) || (i == 0 && /^#[^\s]+/.test(text)))) return null;
const isHead = text[0] == '#'; const isHead = text[0] == '#';
const hashtag = text.match(/^\s?#[^\s]+/)[0]; const hashtag = text.match(/^\s?#[^\s]+/)[0];
const res = !isHead ? [{ const res: any[] = !isHead ? [{
type: 'text', type: 'text',
content: text[0] content: text[0]
}] : []; }] : [];

View File

@ -121,12 +121,21 @@ const endpoints: Endpoint[] = [
{ {
name: 'aggregation/users/following' name: 'aggregation/users/following'
}, },
{
name: 'aggregation/users/reaction'
},
{ {
name: 'aggregation/posts/repost' name: 'aggregation/posts/repost'
}, },
{ {
name: 'aggregation/posts/reply' name: 'aggregation/posts/reply'
}, },
{
name: 'aggregation/posts/reaction'
},
{
name: 'aggregation/posts/reactions'
},
{ {
name: 'i', name: 'i',

View File

@ -3,10 +3,10 @@
*/ */
import $ from 'cafy'; import $ from 'cafy';
import Post from '../../../models/post'; import Post from '../../../models/post';
import Like from '../../../models/like'; import Reaction from '../../../models/post-reaction';
/** /**
* Aggregate like of a post * Aggregate reaction of a post
* *
* @param {any} params * @param {any} params
* @return {Promise<any>} * @return {Promise<any>}
@ -25,7 +25,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
return rej('post not found'); return rej('post not found');
} }
const datas = await Like const datas = await Reaction
.aggregate([ .aggregate([
{ $match: { post_id: post._id } }, { $match: { post_id: post._id } },
{ $project: { { $project: {

View File

@ -3,10 +3,10 @@
*/ */
import $ from 'cafy'; import $ from 'cafy';
import Post from '../../../models/post'; import Post from '../../../models/post';
import Like from '../../../models/like'; import Reaction from '../../../models/post-reaction';
/** /**
* Aggregate likes of a post * Aggregate reactions of a post
* *
* @param {any} params * @param {any} params
* @return {Promise<any>} * @return {Promise<any>}
@ -27,7 +27,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
const startTime = new Date(new Date().setMonth(new Date().getMonth() - 1)); const startTime = new Date(new Date().setMonth(new Date().getMonth() - 1));
const likes = await Like const reactions = await Reaction
.find({ .find({
post_id: post._id, post_id: post._id,
$or: [ $or: [
@ -51,8 +51,8 @@ module.exports = (params) => new Promise(async (res, rej) => {
day = new Date(day.setHours(23)); day = new Date(day.setHours(23));
// day = day.getTime(); // day = day.getTime();
const count = likes.filter(l => const count = reactions.filter(r =>
l.created_at < day && (l.deleted_at == null || l.deleted_at > day) r.created_at < day && (r.deleted_at == null || r.deleted_at > day)
).length; ).length;
graph.push({ graph.push({

View File

@ -3,10 +3,10 @@
*/ */
import $ from 'cafy'; import $ from 'cafy';
import User from '../../../models/user'; import User from '../../../models/user';
import Like from '../../../models/like'; import Reaction from '../../../models/post-reaction';
/** /**
* Aggregate like of a user * Aggregate reaction of a user
* *
* @param {any} params * @param {any} params
* @return {Promise<any>} * @return {Promise<any>}
@ -29,7 +29,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
return rej('user not found'); return rej('user not found');
} }
const datas = await Like const datas = await Reaction
.aggregate([ .aggregate([
{ $match: { user_id: user._id } }, { $match: { user_id: user._id } },
{ $project: { { $project: {

View File

@ -1,7 +1,6 @@
/** /**
* Module dependencies * Module dependencies
*/ */
import prominence from 'prominence';
import version from '../../version'; import version from '../../version';
import config from '../../conf'; import config from '../../conf';

View File

@ -24,8 +24,7 @@ app.set('trust proxy', 'loopback');
if (config.accesses && config.accesses.enable) { if (config.accesses && config.accesses.enable) {
const accesses = new Accesses({ const accesses = new Accesses({
appName: 'Misskey', appName: 'Misskey',
port: config.accesses.port, port: config.accesses.port
hashIp: true
}); });
app.use(accesses.express); app.use(accesses.express);