Merge branch 'develop'
This commit is contained in:
		
						commit
						611e4f34dc
					
				
					 33 changed files with 93 additions and 92 deletions
				
			
		| 
						 | 
				
			
			@ -56,22 +56,10 @@ jobs:
 | 
			
		|||
      executor:
 | 
			
		||||
        type: string
 | 
			
		||||
        default: "default"
 | 
			
		||||
      without_redis:
 | 
			
		||||
        type: boolean
 | 
			
		||||
        default: false
 | 
			
		||||
    executor: <<parameters.executor>>
 | 
			
		||||
    steps:
 | 
			
		||||
      - attach_workspace:
 | 
			
		||||
          at: /tmp/workspace
 | 
			
		||||
      - when:
 | 
			
		||||
          condition: <<parameters.without_redis>>
 | 
			
		||||
          steps:
 | 
			
		||||
            - run:
 | 
			
		||||
                name: Configure
 | 
			
		||||
                command: |
 | 
			
		||||
                  mv .config/test.yml .config/test_redis.yml
 | 
			
		||||
                  touch .config/test.yml
 | 
			
		||||
                  cat .config/test_redis.yml | while IFS= read line; do if [[ "$line" = '# __REDIS__' ]]; then break; else echo "$line" >> .config/test.yml; fi; done
 | 
			
		||||
      - run:
 | 
			
		||||
          name: Test
 | 
			
		||||
          command: |
 | 
			
		||||
| 
						 | 
				
			
			@ -134,32 +122,14 @@ workflows:
 | 
			
		|||
            branches:
 | 
			
		||||
              only: master
 | 
			
		||||
      - test:
 | 
			
		||||
          name: manual-test-with-redis
 | 
			
		||||
          executor: with-redis
 | 
			
		||||
          name: manual-test
 | 
			
		||||
          requires:
 | 
			
		||||
            - manual-build
 | 
			
		||||
          filters:
 | 
			
		||||
            branches:
 | 
			
		||||
              ignore: master
 | 
			
		||||
      - test:
 | 
			
		||||
          name: auto-test-without-redis
 | 
			
		||||
          executor: with-redis
 | 
			
		||||
          requires:
 | 
			
		||||
            - auto-build
 | 
			
		||||
          filters:
 | 
			
		||||
            branches:
 | 
			
		||||
              only: master
 | 
			
		||||
      - test:
 | 
			
		||||
          name: manual-test-with-redis
 | 
			
		||||
          without_redis: true
 | 
			
		||||
          requires:
 | 
			
		||||
            - manual-build
 | 
			
		||||
          filters:
 | 
			
		||||
            branches:
 | 
			
		||||
              ignore: master
 | 
			
		||||
      - test:
 | 
			
		||||
          name: auto-test-without-redis
 | 
			
		||||
          without_redis: true
 | 
			
		||||
          name: auto-test
 | 
			
		||||
          requires:
 | 
			
		||||
            - auto-build
 | 
			
		||||
          filters:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,13 @@ If you encounter any problems with updating, please try the following:
 | 
			
		|||
1. `npm run clean` or `npm run cleanall`
 | 
			
		||||
2. Retry update (Don't forget `npm i`)
 | 
			
		||||
 | 
			
		||||
11.1.5 (2019/04/17)
 | 
			
		||||
-------------------
 | 
			
		||||
### Fixes
 | 
			
		||||
* ユーザー名に含まれているカスタム絵文字が表示されないことがある問題を修正
 | 
			
		||||
* 壁紙の設定ができない問題を修正
 | 
			
		||||
* デザインの調整
 | 
			
		||||
 | 
			
		||||
11.1.4 (2019/04/17)
 | 
			
		||||
-------------------
 | 
			
		||||
### Fixes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,10 +46,40 @@ Convert な(na) to にゃ(nya)
 | 
			
		|||
Revert Nyaize
 | 
			
		||||
 | 
			
		||||
## Code style
 | 
			
		||||
### Use semicolon
 | 
			
		||||
To avoid ASI Hazard
 | 
			
		||||
### セミコロンを省略しない
 | 
			
		||||
ASI Hazardを避けるためでもある
 | 
			
		||||
 | 
			
		||||
### 中括弧を省略しない
 | 
			
		||||
Bad:
 | 
			
		||||
``` ts
 | 
			
		||||
if (foo)
 | 
			
		||||
	bar;
 | 
			
		||||
else
 | 
			
		||||
	baz;
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Good:
 | 
			
		||||
``` ts
 | 
			
		||||
if (foo) {
 | 
			
		||||
	bar;
 | 
			
		||||
} else {
 | 
			
		||||
	baz;
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
ただし**`if`が一行**の時だけは省略しても良い
 | 
			
		||||
Good:
 | 
			
		||||
``` ts
 | 
			
		||||
if (foo) bar;
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### `export default`を使わない
 | 
			
		||||
インテリセンスと相性が悪かったりするため
 | 
			
		||||
 | 
			
		||||
参考:
 | 
			
		||||
* https://gfx.hatenablog.com/entry/2017/11/24/135343
 | 
			
		||||
* https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html
 | 
			
		||||
 | 
			
		||||
### Don't use `export default`
 | 
			
		||||
Bad:
 | 
			
		||||
``` ts
 | 
			
		||||
export default function(foo: string): string {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
{
 | 
			
		||||
	"name": "misskey",
 | 
			
		||||
	"author": "syuilo <i@syuilo.com>",
 | 
			
		||||
	"version": "11.1.4",
 | 
			
		||||
	"version": "11.1.5",
 | 
			
		||||
	"codename": "daybreak",
 | 
			
		||||
	"repository": {
 | 
			
		||||
		"type": "git",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -137,7 +137,6 @@ export default prop => ({
 | 
			
		|||
					Vue.set(this.$_ns_target, 'deletedAt', body.deletedAt);
 | 
			
		||||
					Vue.set(this.$_ns_target, 'renote', null);
 | 
			
		||||
					this.$_ns_target.text = null;
 | 
			
		||||
					this.$_ns_target.tags = [];
 | 
			
		||||
					this.$_ns_target.fileIds = [];
 | 
			
		||||
					this.$_ns_target.poll = null;
 | 
			
		||||
					this.$_ns_target.geo = null;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -121,7 +121,7 @@ export default Vue.extend({
 | 
			
		|||
			if (this.file.properties.avgColor) {
 | 
			
		||||
				anime({
 | 
			
		||||
					targets: this.$refs.thumbnail,
 | 
			
		||||
					backgroundColor: this.file.properties.avgColor.replace('255)', '0)'),
 | 
			
		||||
					backgroundColor: 'transparent', // TODO fade
 | 
			
		||||
					duration: 100,
 | 
			
		||||
					easing: 'linear'
 | 
			
		||||
				});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,7 +32,7 @@ export default Vue.extend({
 | 
			
		|||
 | 
			
		||||
	props: {
 | 
			
		||||
		files: {
 | 
			
		||||
			type: Object,
 | 
			
		||||
			type: Array,
 | 
			
		||||
			required: true
 | 
			
		||||
		},
 | 
			
		||||
		detachMediaFn: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -525,15 +525,11 @@ export default Vue.extend({
 | 
			
		|||
			this.$chooseDriveFile({
 | 
			
		||||
				multiple: false
 | 
			
		||||
			}).then(file => {
 | 
			
		||||
				this.$root.api('i/update', {
 | 
			
		||||
					wallpaperId: file.id
 | 
			
		||||
				});
 | 
			
		||||
				this.$store.dispatch('settings/set', { key: 'wallpaper', value: file.url });
 | 
			
		||||
			});
 | 
			
		||||
		},
 | 
			
		||||
		deleteWallpaper() {
 | 
			
		||||
			this.$root.api('i/update', {
 | 
			
		||||
				wallpaperId: null
 | 
			
		||||
			});
 | 
			
		||||
			this.$store.dispatch('settings/set', { key: 'wallpaper', value: null });
 | 
			
		||||
		},
 | 
			
		||||
		checkForUpdate() {
 | 
			
		||||
			this.checkingForUpdate = true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@
 | 
			
		|||
					<fa :icon="['far', 'laugh']"/>
 | 
			
		||||
				</button>
 | 
			
		||||
			</div>
 | 
			
		||||
			<x-post-form-attaches class="files" :files="files" :detachMediaFn="detachMedia"/>
 | 
			
		||||
			<x-post-form-attaches class="files" :files="files" :detach-media-fn="detachMedia"/>
 | 
			
		||||
			<input ref="file" type="file" multiple="multiple" tabindex="-1" @change="onChangeFile"/>
 | 
			
		||||
			<mk-uploader ref="uploader" @uploaded="attachMedia"/>
 | 
			
		||||
			<footer>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -142,7 +142,7 @@ export default Vue.extend({
 | 
			
		|||
			if (this.file.properties.avgColor) {
 | 
			
		||||
				anime({
 | 
			
		||||
					targets: this.$refs.thumbnail,
 | 
			
		||||
					backgroundColor: this.file.properties.avgColor.replace('255)', '0)'),
 | 
			
		||||
					backgroundColor: 'transparent', // TODO fade
 | 
			
		||||
					duration: 100,
 | 
			
		||||
					easing: 'linear'
 | 
			
		||||
				});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -87,6 +87,5 @@ export default Vue.extend({
 | 
			
		|||
		height 100%
 | 
			
		||||
		flex auto
 | 
			
		||||
		overflow auto
 | 
			
		||||
		background var(--bg)
 | 
			
		||||
 | 
			
		||||
</style>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
<template>
 | 
			
		||||
<div class="mk-ui" v-hotkey.global="keymap">
 | 
			
		||||
	<div class="bg" v-if="$store.getters.isSignedIn && $store.state.i.wallpaperUrl" :style="style"></div>
 | 
			
		||||
	<div class="bg" v-if="$store.getters.isSignedIn && $store.state.settings.wallpaper" :style="style"></div>
 | 
			
		||||
	<x-header class="header" v-if="navbar == 'top'" v-show="!zenMode" ref="header"/>
 | 
			
		||||
	<x-sidebar class="sidebar" v-if="navbar != 'top'" v-show="!zenMode" ref="sidebar"/>
 | 
			
		||||
	<div class="content" :class="[{ sidebar: navbar != 'top', zen: zenMode }, navbar]">
 | 
			
		||||
| 
						 | 
				
			
			@ -33,10 +33,9 @@ export default Vue.extend({
 | 
			
		|||
		},
 | 
			
		||||
 | 
			
		||||
		style(): any {
 | 
			
		||||
			if (!this.$store.getters.isSignedIn || this.$store.state.i.wallpaperUrl == null) return {};
 | 
			
		||||
			if (!this.$store.getters.isSignedIn || this.$store.state.settings.wallpaper == null) return {};
 | 
			
		||||
			return {
 | 
			
		||||
				backgroundColor: this.$store.state.i.wallpaperColor && this.$store.state.i.wallpaperColor.length == 3 ? `rgb(${ this.$store.state.i.wallpaperColor.join(',') })` : null,
 | 
			
		||||
				backgroundImage: `url(${ this.$store.state.i.wallpaperUrl })`
 | 
			
		||||
				backgroundImage: `url(${ this.$store.state.settings.wallpaper })`
 | 
			
		||||
			};
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -96,7 +95,6 @@ export default Vue.extend({
 | 
			
		|||
		background-size cover
 | 
			
		||||
		background-position center
 | 
			
		||||
		background-attachment fixed
 | 
			
		||||
		opacity 0.3
 | 
			
		||||
 | 
			
		||||
	> .content.sidebar.left
 | 
			
		||||
		padding-left 68px
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,6 +28,7 @@ const defaultSettings = {
 | 
			
		|||
	iLikeSushi: false,
 | 
			
		||||
	rememberNoteVisibility: false,
 | 
			
		||||
	defaultNoteVisibility: 'public',
 | 
			
		||||
	wallpaper: null,
 | 
			
		||||
	webSearchEngine: 'https://www.google.com/?#q={{query}}',
 | 
			
		||||
	mutedWords: [],
 | 
			
		||||
	games: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,8 +76,6 @@ class MyCustomLogger implements Logger {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
export function initDb(justBorrow = false, sync = false, log = false) {
 | 
			
		||||
	const enableLogging = log || !['production', 'test'].includes(process.env.NODE_ENV || '');
 | 
			
		||||
 | 
			
		||||
	try {
 | 
			
		||||
		const conn = getConnection();
 | 
			
		||||
		return Promise.resolve(conn);
 | 
			
		||||
| 
						 | 
				
			
			@ -92,8 +90,8 @@ export function initDb(justBorrow = false, sync = false, log = false) {
 | 
			
		|||
		database: config.db.db,
 | 
			
		||||
		synchronize: process.env.NODE_ENV === 'test' || sync,
 | 
			
		||||
		dropSchema: process.env.NODE_ENV === 'test' && !justBorrow,
 | 
			
		||||
		logging: enableLogging,
 | 
			
		||||
		logger: enableLogging ? new MyCustomLogger() : undefined,
 | 
			
		||||
		logging: log,
 | 
			
		||||
		logger: log ? new MyCustomLogger() : undefined,
 | 
			
		||||
		entities: [
 | 
			
		||||
			Meta,
 | 
			
		||||
			Instance,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -178,12 +178,11 @@ export class NoteRepository extends Repository<Note> {
 | 
			
		|||
				name: In(reactionEmojis),
 | 
			
		||||
				host: host
 | 
			
		||||
			}) : [],
 | 
			
		||||
			tags: note.tags,
 | 
			
		||||
			fileIds: note.fileIds,
 | 
			
		||||
			files: DriveFiles.packMany(note.fileIds),
 | 
			
		||||
			replyId: note.replyId,
 | 
			
		||||
			renoteId: note.renoteId,
 | 
			
		||||
			uri: note.uri,
 | 
			
		||||
			uri: note.uri || undefined,
 | 
			
		||||
 | 
			
		||||
			...(opts.detail ? {
 | 
			
		||||
				reply: note.replyId ? this.pack(note.replyId, meId, {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,7 +82,7 @@ export class UserRepository extends Repository<User> {
 | 
			
		|||
 | 
			
		||||
		const relation = meId && (meId !== user.id) && opts.detail ? await this.getRelation(meId, user.id) : null;
 | 
			
		||||
		const pins = opts.detail ? await UserNotePinings.find({ userId: user.id }) : [];
 | 
			
		||||
		const profile = opts.detail ? await UserProfiles.findOne({ userId: user.id }).then(ensure) : null;
 | 
			
		||||
		const profile = opts.detail ? await UserProfiles.findOne(user.id).then(ensure) : null;
 | 
			
		||||
 | 
			
		||||
		const falsy = opts.detail ? false : undefined;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ export async function renderPerson(user: ILocalUser) {
 | 
			
		|||
	const [avatar, banner, profile] = await Promise.all([
 | 
			
		||||
		user.avatarId ? DriveFiles.findOne(user.avatarId) : Promise.resolve(undefined),
 | 
			
		||||
		user.bannerId ? DriveFiles.findOne(user.bannerId) : Promise.resolve(undefined),
 | 
			
		||||
		UserProfiles.findOne({ userId: user.id }).then(ensure)
 | 
			
		||||
		UserProfiles.findOne(user.id).then(ensure)
 | 
			
		||||
	]);
 | 
			
		||||
 | 
			
		||||
	const attachment: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ export const meta = {
 | 
			
		|||
export default define(meta, async (ps, user) => {
 | 
			
		||||
	const token = ps.token.replace(/\s/g, '');
 | 
			
		||||
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	if (profile.twoFactorTempSecret == null) {
 | 
			
		||||
		throw new Error('二段階認証の設定が開始されていません');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ export const meta = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export default define(meta, async (ps, user) => {
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	// Compare password
 | 
			
		||||
	const same = await bcrypt.compare(ps.password, profile.password!);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ export const meta = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export default define(meta, async (ps, user) => {
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	// Compare password
 | 
			
		||||
	const same = await bcrypt.compare(ps.password, profile.password!);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@ export const meta = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export default define(meta, async (ps, user) => {
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	// Compare password
 | 
			
		||||
	const same = await bcrypt.compare(ps.currentPassword, profile.password!);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ export const meta = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export default define(meta, async (ps, user) => {
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	// Compare password
 | 
			
		||||
	const same = await bcrypt.compare(ps.password, profile.password!);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ export const meta = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export default define(meta, async (ps, user) => {
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	// Compare password
 | 
			
		||||
	const same = await bcrypt.compare(ps.password, profile.password!);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ export const meta = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
export default define(meta, async (ps, user) => {
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	// Compare password
 | 
			
		||||
	const same = await bcrypt.compare(ps.password, profile.password!);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,7 @@ import { ApiError } from '../../error';
 | 
			
		|||
import { Users, DriveFiles, UserProfiles } from '../../../../models';
 | 
			
		||||
import { User } from '../../../../models/entities/user';
 | 
			
		||||
import { UserProfile } from '../../../../models/entities/user-profile';
 | 
			
		||||
import { ensure } from '../../../../prelude/ensure';
 | 
			
		||||
 | 
			
		||||
export const meta = {
 | 
			
		||||
	desc: {
 | 
			
		||||
| 
						 | 
				
			
			@ -157,22 +158,24 @@ export default define(meta, async (ps, user, app) => {
 | 
			
		|||
	const isSecure = user != null && app == null;
 | 
			
		||||
 | 
			
		||||
	const updates = {} as Partial<User>;
 | 
			
		||||
	const profile = {} as Partial<UserProfile>;
 | 
			
		||||
	const profileUpdates = {} as Partial<UserProfile>;
 | 
			
		||||
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	if (ps.name !== undefined) updates.name = ps.name;
 | 
			
		||||
	if (ps.description !== undefined) profile.description = ps.description;
 | 
			
		||||
	if (ps.description !== undefined) profileUpdates.description = ps.description;
 | 
			
		||||
	//if (ps.lang !== undefined) updates.lang = ps.lang;
 | 
			
		||||
	if (ps.location !== undefined) profile.location = ps.location;
 | 
			
		||||
	if (ps.birthday !== undefined) profile.birthday = ps.birthday;
 | 
			
		||||
	if (ps.location !== undefined) profileUpdates.location = ps.location;
 | 
			
		||||
	if (ps.birthday !== undefined) profileUpdates.birthday = ps.birthday;
 | 
			
		||||
	if (ps.avatarId !== undefined) updates.avatarId = ps.avatarId;
 | 
			
		||||
	if (ps.bannerId !== undefined) updates.bannerId = ps.bannerId;
 | 
			
		||||
	if (typeof ps.isLocked == 'boolean') updates.isLocked = ps.isLocked;
 | 
			
		||||
	if (typeof ps.isBot == 'boolean') updates.isBot = ps.isBot;
 | 
			
		||||
	if (typeof ps.carefulBot == 'boolean') profile.carefulBot = ps.carefulBot;
 | 
			
		||||
	if (typeof ps.autoAcceptFollowed == 'boolean') profile.autoAcceptFollowed = ps.autoAcceptFollowed;
 | 
			
		||||
	if (typeof ps.carefulBot == 'boolean') profileUpdates.carefulBot = ps.carefulBot;
 | 
			
		||||
	if (typeof ps.autoAcceptFollowed == 'boolean') profileUpdates.autoAcceptFollowed = ps.autoAcceptFollowed;
 | 
			
		||||
	if (typeof ps.isCat == 'boolean') updates.isCat = ps.isCat;
 | 
			
		||||
	if (typeof ps.autoWatch == 'boolean') profile.autoWatch = ps.autoWatch;
 | 
			
		||||
	if (typeof ps.alwaysMarkNsfw == 'boolean') profile.alwaysMarkNsfw = ps.alwaysMarkNsfw;
 | 
			
		||||
	if (typeof ps.autoWatch == 'boolean') profileUpdates.autoWatch = ps.autoWatch;
 | 
			
		||||
	if (typeof ps.alwaysMarkNsfw == 'boolean') profileUpdates.alwaysMarkNsfw = ps.alwaysMarkNsfw;
 | 
			
		||||
 | 
			
		||||
	if (ps.avatarId) {
 | 
			
		||||
		const avatar = await DriveFiles.findOne(ps.avatarId);
 | 
			
		||||
| 
						 | 
				
			
			@ -201,16 +204,20 @@ export default define(meta, async (ps, user, app) => {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	//#region emojis/tags
 | 
			
		||||
 | 
			
		||||
	let emojis = [] as string[];
 | 
			
		||||
	let tags = [] as string[];
 | 
			
		||||
 | 
			
		||||
	if (updates.name != null) {
 | 
			
		||||
		const tokens = parsePlain(updates.name);
 | 
			
		||||
	const newName = updates.name === undefined ? user.name : updates.name;
 | 
			
		||||
	const newDescription = profileUpdates.description === undefined ? profile.description : profileUpdates.description;
 | 
			
		||||
 | 
			
		||||
	if (newName != null) {
 | 
			
		||||
		const tokens = parsePlain(newName);
 | 
			
		||||
		emojis = emojis.concat(extractEmojis(tokens!));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (profile.description != null) {
 | 
			
		||||
		const tokens = parse(profile.description);
 | 
			
		||||
	if (newDescription != null) {
 | 
			
		||||
		const tokens = parse(newDescription);
 | 
			
		||||
		emojis = emojis.concat(extractEmojis(tokens!));
 | 
			
		||||
		tags = extractHashtags(tokens!).map(tag => tag.toLowerCase());
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -224,7 +231,7 @@ export default define(meta, async (ps, user, app) => {
 | 
			
		|||
	//#endregion
 | 
			
		||||
 | 
			
		||||
	if (Object.keys(updates).length > 0) await Users.update(user.id, updates);
 | 
			
		||||
	if (Object.keys(profile).length > 0) await UserProfiles.update({ userId: user.id }, profile);
 | 
			
		||||
	if (Object.keys(profileUpdates).length > 0) await UserProfiles.update({ userId: user.id }, profileUpdates);
 | 
			
		||||
 | 
			
		||||
	const iObj = await Users.pack(user.id, user, {
 | 
			
		||||
		detail: true,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -150,7 +150,7 @@ export default define(meta, async (ps, user) => {
 | 
			
		|||
		}
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	// この投稿をWatchする
 | 
			
		||||
	if (profile.autoWatch !== false) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,3 @@
 | 
			
		|||
 | 
			
		||||
export const schemas = {
 | 
			
		||||
	Error: {
 | 
			
		||||
		type: 'object',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ export default async (ctx: Koa.BaseContext) => {
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	// Compare password
 | 
			
		||||
	const same = await bcrypt.compare(password, profile.password!);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ export default async function(user: User) {
 | 
			
		|||
		name: user.name || user.username
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	const notes = await Notes.find({
 | 
			
		||||
		where: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -363,16 +363,14 @@ export default async function(
 | 
			
		|||
 | 
			
		||||
				logger.debug(`average color is calculated: ${r}, ${g}, ${b}`);
 | 
			
		||||
 | 
			
		||||
				const value = info.isOpaque ? `rgba(${r},${g},${b},0)` : `rgba(${r},${g},${b},255)`;
 | 
			
		||||
 | 
			
		||||
				properties['avgColor'] = value;
 | 
			
		||||
				properties['avgColor'] = `rgb(${r},${g},${b})`;
 | 
			
		||||
			} catch (e) { }
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		propPromises = [calcWh(), calcAvg()];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id });
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id);
 | 
			
		||||
 | 
			
		||||
	const [folder] = await Promise.all([fetchFolder(), Promise.all(propPromises)]);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -253,7 +253,7 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
 | 
			
		|||
		deliverNoteToMentionedRemoteUsers(mentionedUsers, user, noteActivity);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id }).then(ensure);
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id).then(ensure);
 | 
			
		||||
 | 
			
		||||
	// If has in reply to note
 | 
			
		||||
	if (data.reply) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,7 +67,7 @@ export default async function(user: User, note: Note, choice: number) {
 | 
			
		|||
		}
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id });
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id);
 | 
			
		||||
 | 
			
		||||
	// ローカルユーザーが投票した場合この投稿をWatchする
 | 
			
		||||
	if (Users.isLocalUser(user) && profile!.autoWatch) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -80,7 +80,7 @@ export default async (user: User, note: Note, reaction?: string) => {
 | 
			
		|||
		}
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	const profile = await UserProfiles.findOne({ userId: user.id });
 | 
			
		||||
	const profile = await UserProfiles.findOne(user.id);
 | 
			
		||||
 | 
			
		||||
	// ユーザーがローカルユーザーかつ自動ウォッチ設定がオンならばこの投稿をWatchする
 | 
			
		||||
	if (Users.isLocalUser(user) && profile!.autoWatch) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue