forked from misskey-dev/misskey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update gitattribute editorconfig * Normalize all the line endings
- Loading branch information
Showing
8 changed files
with
165 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
*.glb -diff -text | ||
*.blend -diff -text | ||
*.afdesign -diff -text | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
name: Check copyright year | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
|
||
jobs: | ||
check_copyright_year: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- run: | | ||
if [ "$(grep Copyright COPYING | sed -e 's/.*2014-\([0-9]*\) .*/\1/g')" -ne "$(date +%Y)" ]; then | ||
echo "Please change copyright year!" | ||
exit 1 | ||
fi | ||
name: Check copyright year | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
|
||
jobs: | ||
check_copyright_year: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- run: | | ||
if [ "$(grep Copyright COPYING | sed -e 's/.*2014-\([0-9]*\) .*/\1/g')" -ne "$(date +%Y)" ]; then | ||
echo "Please change copyright year!" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
|
||
jobs: | ||
pnpm_install: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 7 | ||
run_install: false | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 18.x | ||
cache: 'pnpm' | ||
- run: corepack enable | ||
- run: pnpm i --frozen-lockfile | ||
|
||
lint: | ||
needs: [pnpm_install] | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
strategy: | ||
matrix: | ||
workspace: | ||
- backend | ||
- frontend | ||
- sw | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 7 | ||
run_install: false | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 18.x | ||
cache: 'pnpm' | ||
- run: corepack enable | ||
- run: pnpm i --frozen-lockfile | ||
- run: pnpm --filter ${{ matrix.workspace }} run lint | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
|
||
jobs: | ||
pnpm_install: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 7 | ||
run_install: false | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 18.x | ||
cache: 'pnpm' | ||
- run: corepack enable | ||
- run: pnpm i --frozen-lockfile | ||
|
||
lint: | ||
needs: [pnpm_install] | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
strategy: | ||
matrix: | ||
workspace: | ||
- backend | ||
- frontend | ||
- sw | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 7 | ||
run_install: false | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 18.x | ||
cache: 'pnpm' | ||
- run: corepack enable | ||
- run: pnpm i --frozen-lockfile | ||
- run: pnpm --filter ${{ matrix.workspace }} run lint |
144 changes: 72 additions & 72 deletions
144
packages/backend/src/server/api/endpoints/clips/remove-note.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,72 @@ | ||
import { Inject, Injectable } from '@nestjs/common'; | ||
import { Endpoint } from '@/server/api/endpoint-base.js'; | ||
import type { ClipNotesRepository, ClipsRepository } from '@/models/index.js'; | ||
import { DI } from '@/di-symbols.js'; | ||
import { ApiError } from '../../error.js'; | ||
import { GetterService } from '@/server/api/GetterService.js'; | ||
|
||
export const meta = { | ||
tags: ['account', 'notes', 'clips'], | ||
|
||
requireCredential: true, | ||
|
||
kind: 'write:account', | ||
|
||
errors: { | ||
noSuchClip: { | ||
message: 'No such clip.', | ||
code: 'NO_SUCH_CLIP', | ||
id: 'b80525c6-97f7-49d7-a42d-ebccd49cfd52', | ||
}, | ||
|
||
noSuchNote: { | ||
message: 'No such note.', | ||
code: 'NO_SUCH_NOTE', | ||
id: 'aff017de-190e-434b-893e-33a9ff5049d8', | ||
}, | ||
}, | ||
} as const; | ||
|
||
export const paramDef = { | ||
type: 'object', | ||
properties: { | ||
clipId: { type: 'string', format: 'misskey:id' }, | ||
noteId: { type: 'string', format: 'misskey:id' }, | ||
}, | ||
required: ['clipId', 'noteId'], | ||
} as const; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
@Injectable() | ||
export default class extends Endpoint<typeof meta, typeof paramDef> { | ||
constructor( | ||
@Inject(DI.clipsRepository) | ||
private clipsRepository: ClipsRepository, | ||
|
||
@Inject(DI.clipNotesRepository) | ||
private clipNotesRepository: ClipNotesRepository, | ||
|
||
private getterService: GetterService, | ||
) { | ||
super(meta, paramDef, async (ps, me) => { | ||
const clip = await this.clipsRepository.findOneBy({ | ||
id: ps.clipId, | ||
userId: me.id, | ||
}); | ||
|
||
if (clip == null) { | ||
throw new ApiError(meta.errors.noSuchClip); | ||
} | ||
|
||
const note = await this.getterService.getNote(ps.noteId).catch(err => { | ||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); | ||
throw err; | ||
}); | ||
|
||
await this.clipNotesRepository.delete({ | ||
noteId: note.id, | ||
clipId: clip.id, | ||
}); | ||
}); | ||
} | ||
} | ||
import { Inject, Injectable } from '@nestjs/common'; | ||
import { Endpoint } from '@/server/api/endpoint-base.js'; | ||
import type { ClipNotesRepository, ClipsRepository } from '@/models/index.js'; | ||
import { DI } from '@/di-symbols.js'; | ||
import { ApiError } from '../../error.js'; | ||
import { GetterService } from '@/server/api/GetterService.js'; | ||
|
||
export const meta = { | ||
tags: ['account', 'notes', 'clips'], | ||
|
||
requireCredential: true, | ||
|
||
kind: 'write:account', | ||
|
||
errors: { | ||
noSuchClip: { | ||
message: 'No such clip.', | ||
code: 'NO_SUCH_CLIP', | ||
id: 'b80525c6-97f7-49d7-a42d-ebccd49cfd52', | ||
}, | ||
|
||
noSuchNote: { | ||
message: 'No such note.', | ||
code: 'NO_SUCH_NOTE', | ||
id: 'aff017de-190e-434b-893e-33a9ff5049d8', | ||
}, | ||
}, | ||
} as const; | ||
|
||
export const paramDef = { | ||
type: 'object', | ||
properties: { | ||
clipId: { type: 'string', format: 'misskey:id' }, | ||
noteId: { type: 'string', format: 'misskey:id' }, | ||
}, | ||
required: ['clipId', 'noteId'], | ||
} as const; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
@Injectable() | ||
export default class extends Endpoint<typeof meta, typeof paramDef> { | ||
constructor( | ||
@Inject(DI.clipsRepository) | ||
private clipsRepository: ClipsRepository, | ||
|
||
@Inject(DI.clipNotesRepository) | ||
private clipNotesRepository: ClipNotesRepository, | ||
|
||
private getterService: GetterService, | ||
) { | ||
super(meta, paramDef, async (ps, me) => { | ||
const clip = await this.clipsRepository.findOneBy({ | ||
id: ps.clipId, | ||
userId: me.id, | ||
}); | ||
|
||
if (clip == null) { | ||
throw new ApiError(meta.errors.noSuchClip); | ||
} | ||
|
||
const note = await this.getterService.getNote(ps.noteId).catch(err => { | ||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote); | ||
throw err; | ||
}); | ||
|
||
await this.clipNotesRepository.delete({ | ||
noteId: note.id, | ||
clipId: clip.id, | ||
}); | ||
}); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.