Compare commits
3 Commits
11.0.0-bet
...
11.0.0-bet
Author | SHA1 | Date | |
---|---|---|---|
8e344f2deb | |||
c28f4ffb3f | |||
2a40240310 |
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "11.0.0-beta.1",
|
"version": "11.0.0-beta.2",
|
||||||
"codename": "daybreak",
|
"codename": "daybreak",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -6,10 +6,6 @@ import { User } from './user';
|
|||||||
@Entity()
|
@Entity()
|
||||||
export class Poll {
|
export class Poll {
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public id: string;
|
|
||||||
|
|
||||||
@Index({ unique: true })
|
|
||||||
@Column(id())
|
|
||||||
public noteId: Note['id'];
|
public noteId: Note['id'];
|
||||||
|
|
||||||
@OneToOne(type => Note, {
|
@OneToOne(type => Note, {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
|
import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from 'typeorm';
|
||||||
import { User } from './user';
|
import { User } from './user';
|
||||||
import { id } from '../id';
|
import { id } from '../id';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class UserKeypair {
|
export class UserKeypair {
|
||||||
@Index({ unique: true })
|
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public userId: User['id'];
|
public userId: User['id'];
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import { User } from './user';
|
|||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class UserProfile {
|
export class UserProfile {
|
||||||
@Index({ unique: true })
|
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public userId: User['id'];
|
public userId: User['id'];
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import { id } from '../id';
|
|||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class UserPublickey {
|
export class UserPublickey {
|
||||||
@Index({ unique: true })
|
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public userId: User['id'];
|
public userId: User['id'];
|
||||||
|
|
||||||
|
@ -170,6 +170,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
|
|||||||
userId: user.id,
|
userId: user.id,
|
||||||
description: fromHtml(person.summary),
|
description: fromHtml(person.summary),
|
||||||
fields,
|
fields,
|
||||||
|
userHost: host
|
||||||
} as Partial<UserProfile>);
|
} as Partial<UserProfile>);
|
||||||
|
|
||||||
await UserPublickeys.save({
|
await UserPublickeys.save({
|
||||||
|
@ -72,7 +72,7 @@ export async function updateQuestion(value: any) {
|
|||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
});
|
});
|
||||||
|
|
||||||
await Polls.update(poll.id, {
|
await Polls.update({ noteId: note.id }, {
|
||||||
votes: poll.votes
|
votes: poll.votes
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ export default define(meta, async (ps, user) => {
|
|||||||
|
|
||||||
// Increment votes count
|
// Increment votes count
|
||||||
const index = ps.choice + 1; // In SQL, array index is 1 based
|
const index = ps.choice + 1; // In SQL, array index is 1 based
|
||||||
await Polls.query(`UPDATE poll SET votes[${index}] = votes[${index}] + 1 WHERE id = '${poll.id}'`);
|
await Polls.query(`UPDATE poll SET votes[${index}] = votes[${index}] + 1 WHERE noteId = '${poll.noteId}'`);
|
||||||
|
|
||||||
publishNoteStream(note.id, 'pollVoted', {
|
publishNoteStream(note.id, 'pollVoted', {
|
||||||
choice: ps.choice,
|
choice: ps.choice,
|
||||||
|
@ -398,7 +398,6 @@ async function insertNote(user: User, data: Option, tags: string[], emojis: stri
|
|||||||
|
|
||||||
if (note.hasPoll) {
|
if (note.hasPoll) {
|
||||||
await Polls.save({
|
await Polls.save({
|
||||||
id: genId(),
|
|
||||||
noteId: note.id,
|
noteId: note.id,
|
||||||
choices: data.poll.choices,
|
choices: data.poll.choices,
|
||||||
expiresAt: data.poll.expiresAt,
|
expiresAt: data.poll.expiresAt,
|
||||||
|
@ -40,7 +40,7 @@ export default (user: User, note: Note, choice: number) => new Promise(async (re
|
|||||||
|
|
||||||
// Increment votes count
|
// Increment votes count
|
||||||
const index = choice + 1; // In SQL, array index is 1 based
|
const index = choice + 1; // In SQL, array index is 1 based
|
||||||
await Polls.query(`UPDATE poll SET votes[${index}] = votes[${index}] + 1 WHERE id = '${poll.id}'`);
|
await Polls.query(`UPDATE poll SET votes[${index}] = votes[${index}] + 1 WHERE noteId = '${poll.noteId}'`);
|
||||||
|
|
||||||
publishNoteStream(note.id, 'pollVoted', {
|
publishNoteStream(note.id, 'pollVoted', {
|
||||||
choice: choice,
|
choice: choice,
|
||||||
|
Reference in New Issue
Block a user