diff --git a/src/api/private/me/history/history.controller.spec.ts b/src/api/private/me/history/history.controller.spec.ts index 2b5da6db2..be83cfbf7 100644 --- a/src/api/private/me/history/history.controller.spec.ts +++ b/src/api/private/me/history/history.controller.spec.ts @@ -19,7 +19,6 @@ import { User } from '../../../../users/user.entity'; import { Note } from '../../../../notes/note.entity'; import { AuthToken } from '../../../../auth/auth-token.entity'; import { Identity } from '../../../../users/identity.entity'; -import { AuthorColor } from '../../../../notes/author-color.entity'; import { Authorship } from '../../../../revisions/authorship.entity'; import { Revision } from '../../../../revisions/revision.entity'; import { Tag } from '../../../../notes/tag.entity'; @@ -58,8 +57,6 @@ describe('HistoryController', () => { .useValue({}) .overrideProvider(getRepositoryToken(Identity)) .useValue({}) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) .overrideProvider(getRepositoryToken(Revision)) diff --git a/src/api/private/me/me.controller.spec.ts b/src/api/private/me/me.controller.spec.ts index 55a5e81d9..f49705ffc 100644 --- a/src/api/private/me/me.controller.spec.ts +++ b/src/api/private/me/me.controller.spec.ts @@ -12,7 +12,6 @@ import { getRepositoryToken } from '@nestjs/typeorm'; import { User } from '../../../users/user.entity'; import { Identity } from '../../../users/identity.entity'; import { MediaModule } from '../../../media/media.module'; -import { AuthorColor } from '../../../notes/author-color.entity'; import { NoteGroupPermission } from '../../../permissions/note-group-permission.entity'; import { NoteUserPermission } from '../../../permissions/note-user-permission.entity'; import { Authorship } from '../../../revisions/authorship.entity'; @@ -62,8 +61,6 @@ describe('MeController', () => { .useValue({}) .overrideProvider(getRepositoryToken(Group)) .useValue({}) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(NoteGroupPermission)) .useValue({}) .overrideProvider(getRepositoryToken(NoteUserPermission)) diff --git a/src/api/private/media/media.controller.spec.ts b/src/api/private/media/media.controller.spec.ts index 61e60dbf7..c37fb68cc 100644 --- a/src/api/private/media/media.controller.spec.ts +++ b/src/api/private/media/media.controller.spec.ts @@ -16,7 +16,6 @@ import externalConfigMock from '../../../config/mock/external-services.config.mo import { MediaModule } from '../../../media/media.module'; import { NotesModule } from '../../../notes/notes.module'; import { getRepositoryToken } from '@nestjs/typeorm'; -import { AuthorColor } from '../../../notes/author-color.entity'; import { Authorship } from '../../../revisions/authorship.entity'; import { AuthToken } from '../../../auth/auth-token.entity'; import { Identity } from '../../../users/identity.entity'; @@ -51,8 +50,6 @@ describe('MediaController', () => { ], controllers: [MediaController], }) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) .overrideProvider(getRepositoryToken(AuthToken)) diff --git a/src/api/private/notes/notes.controller.spec.ts b/src/api/private/notes/notes.controller.spec.ts index 848c54727..e6f355b9c 100644 --- a/src/api/private/notes/notes.controller.spec.ts +++ b/src/api/private/notes/notes.controller.spec.ts @@ -26,7 +26,6 @@ import appConfigMock from '../../../config/mock/app.config.mock'; import mediaConfigMock from '../../../config/mock/media.config.mock'; import { Revision } from '../../../revisions/revision.entity'; import { Authorship } from '../../../revisions/authorship.entity'; -import { AuthorColor } from '../../../notes/author-color.entity'; import { User } from '../../../users/user.entity'; import { AuthToken } from '../../../auth/auth-token.entity'; import { Identity } from '../../../users/identity.entity'; @@ -74,8 +73,7 @@ describe('NotesController', () => { .useValue({}) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) + .overrideProvider(getRepositoryToken(User)) .useValue({}) .overrideProvider(getRepositoryToken(AuthToken)) diff --git a/src/api/public/me/me.controller.spec.ts b/src/api/public/me/me.controller.spec.ts index bf61c10a6..c22965d10 100644 --- a/src/api/public/me/me.controller.spec.ts +++ b/src/api/public/me/me.controller.spec.ts @@ -12,7 +12,6 @@ import { } from '@nestjs/typeorm'; import { HistoryModule } from '../../../history/history.module'; import { LoggerModule } from '../../../logger/logger.module'; -import { AuthorColor } from '../../../notes/author-color.entity'; import { Note } from '../../../notes/note.entity'; import { NotesModule } from '../../../notes/notes.module'; import { Tag } from '../../../notes/tag.entity'; @@ -62,8 +61,6 @@ describe('Me Controller', () => { .useValue({}) .overrideProvider(getRepositoryToken(Identity)) .useValue({}) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) .overrideProvider(getRepositoryToken(Revision)) diff --git a/src/api/public/media/media.controller.spec.ts b/src/api/public/media/media.controller.spec.ts index be1126898..6358c6dc2 100644 --- a/src/api/public/media/media.controller.spec.ts +++ b/src/api/public/media/media.controller.spec.ts @@ -12,7 +12,6 @@ import mediaConfigMock from '../../../config/mock/media.config.mock'; import { LoggerModule } from '../../../logger/logger.module'; import { MediaUpload } from '../../../media/media-upload.entity'; import { MediaModule } from '../../../media/media.module'; -import { AuthorColor } from '../../../notes/author-color.entity'; import { Note } from '../../../notes/note.entity'; import { NotesModule } from '../../../notes/notes.module'; import { Tag } from '../../../notes/tag.entity'; @@ -42,8 +41,6 @@ describe('Media Controller', () => { NotesModule, ], }) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) .overrideProvider(getRepositoryToken(AuthToken)) diff --git a/src/api/public/notes/notes.controller.spec.ts b/src/api/public/notes/notes.controller.spec.ts index 867e36d9e..d4f31b9d9 100644 --- a/src/api/public/notes/notes.controller.spec.ts +++ b/src/api/public/notes/notes.controller.spec.ts @@ -11,7 +11,6 @@ import { TypeOrmModule, } from '@nestjs/typeorm'; import { LoggerModule } from '../../../logger/logger.module'; -import { AuthorColor } from '../../../notes/author-color.entity'; import { Note } from '../../../notes/note.entity'; import { NotesService } from '../../../notes/notes.service'; import { Tag } from '../../../notes/tag.entity'; @@ -76,8 +75,6 @@ describe('Notes Controller', () => { .useValue({}) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(User)) .useValue({}) .overrideProvider(getRepositoryToken(AuthToken)) diff --git a/src/history/history.service.spec.ts b/src/history/history.service.spec.ts index 509a9382f..ed5534d11 100644 --- a/src/history/history.service.spec.ts +++ b/src/history/history.service.spec.ts @@ -12,7 +12,6 @@ import { NotesModule } from '../notes/notes.module'; import { getConnectionToken, getRepositoryToken } from '@nestjs/typeorm'; import { Identity } from '../users/identity.entity'; import { User } from '../users/user.entity'; -import { AuthorColor } from '../notes/author-color.entity'; import { Authorship } from '../revisions/authorship.entity'; import { HistoryEntry } from './history-entry.entity'; import { Note } from '../notes/note.entity'; @@ -75,8 +74,6 @@ describe('HistoryService', () => { .useValue({}) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(Revision)) .useValue({}) .overrideProvider(getRepositoryToken(Note)) diff --git a/src/media/media.service.spec.ts b/src/media/media.service.spec.ts index 3d0a098bd..58bfcd472 100644 --- a/src/media/media.service.spec.ts +++ b/src/media/media.service.spec.ts @@ -9,7 +9,6 @@ import { Test, TestingModule } from '@nestjs/testing'; import { getRepositoryToken } from '@nestjs/typeorm'; import mediaConfigMock from '../config/mock/media.config.mock'; import { LoggerModule } from '../logger/logger.module'; -import { AuthorColor } from '../notes/author-color.entity'; import { Note } from '../notes/note.entity'; import { NotesModule } from '../notes/notes.module'; import { Tag } from '../notes/tag.entity'; @@ -56,8 +55,6 @@ describe('MediaService', () => { UsersModule, ], }) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) .overrideProvider(getRepositoryToken(AuthToken)) diff --git a/src/notes/author-color.entity.ts b/src/notes/author-color.entity.ts deleted file mode 100644 index 965d5e6f9..000000000 --- a/src/notes/author-color.entity.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Column, Entity, ManyToOne } from 'typeorm'; -import { User } from '../users/user.entity'; -import { Note } from './note.entity'; - -@Entity() -export class AuthorColor { - @ManyToOne((_) => Note, (note) => note.authorColors, { - primary: true, - }) - note: Note; - - @ManyToOne((_) => User, { - primary: true, - }) - user: User; - - @Column() - color: string; -} diff --git a/src/notes/note.entity.ts b/src/notes/note.entity.ts index 6a3067b76..8cca4de6c 100644 --- a/src/notes/note.entity.ts +++ b/src/notes/note.entity.ts @@ -17,7 +17,6 @@ import { NoteGroupPermission } from '../permissions/note-group-permission.entity import { NoteUserPermission } from '../permissions/note-user-permission.entity'; import { Revision } from '../revisions/revision.entity'; import { User } from '../users/user.entity'; -import { AuthorColor } from './author-color.entity'; import { Tag } from './tag.entity'; import { HistoryEntry } from '../history/history-entry.entity'; import { MediaUpload } from '../media/media-upload.entity'; @@ -59,8 +58,6 @@ export class Note { owner: User | null; @OneToMany((_) => Revision, (revision) => revision.note, { cascade: true }) revisions: Promise; - @OneToMany((_) => AuthorColor, (authorColor) => authorColor.note) - authorColors: AuthorColor[]; @OneToMany((_) => HistoryEntry, (historyEntry) => historyEntry.user) historyEntries: HistoryEntry[]; @OneToMany((_) => MediaUpload, (mediaUpload) => mediaUpload.note) @@ -90,7 +87,6 @@ export class Note { newNote.alias = alias ?? null; newNote.viewCount = 0; newNote.owner = owner ?? null; - newNote.authorColors = []; newNote.userPermissions = []; newNote.groupPermissions = []; newNote.revisions = Promise.resolve([]) as Promise; diff --git a/src/notes/notes.module.ts b/src/notes/notes.module.ts index 685752038..728f92ef3 100644 --- a/src/notes/notes.module.ts +++ b/src/notes/notes.module.ts @@ -5,24 +5,22 @@ */ import { forwardRef, Module } from '@nestjs/common'; +import { ConfigModule } from '@nestjs/config'; import { TypeOrmModule } from '@nestjs/typeorm'; +import { GroupsModule } from '../groups/groups.module'; import { LoggerModule } from '../logger/logger.module'; +import { NoteGroupPermission } from '../permissions/note-group-permission.entity'; +import { NoteUserPermission } from '../permissions/note-user-permission.entity'; import { RevisionsModule } from '../revisions/revisions.module'; import { UsersModule } from '../users/users.module'; -import { AuthorColor } from './author-color.entity'; import { Note } from './note.entity'; import { NotesService } from './notes.service'; import { Tag } from './tag.entity'; -import { NoteGroupPermission } from '../permissions/note-group-permission.entity'; -import { NoteUserPermission } from '../permissions/note-user-permission.entity'; -import { GroupsModule } from '../groups/groups.module'; -import { ConfigModule } from '@nestjs/config'; @Module({ imports: [ TypeOrmModule.forFeature([ Note, - AuthorColor, Tag, NoteGroupPermission, NoteUserPermission, diff --git a/src/notes/notes.service.spec.ts b/src/notes/notes.service.spec.ts index 2d8350c71..230536857 100644 --- a/src/notes/notes.service.spec.ts +++ b/src/notes/notes.service.spec.ts @@ -14,7 +14,6 @@ import { AuthToken } from '../auth/auth-token.entity'; import { Identity } from '../users/identity.entity'; import { User } from '../users/user.entity'; import { UsersModule } from '../users/users.module'; -import { AuthorColor } from './author-color.entity'; import { Note } from './note.entity'; import { NotesService } from './notes.service'; import { Repository } from 'typeorm'; @@ -80,8 +79,6 @@ describe('NotesService', () => { .useValue({}) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(Revision)) .useClass(Repository) .overrideProvider(getRepositoryToken(NoteGroupPermission)) @@ -688,13 +685,6 @@ describe('NotesService', () => { note.alias = 'testAlias'; note.title = 'testTitle'; note.description = 'testDescription'; - note.authorColors = [ - { - note: note, - user: user, - color: 'red', - } as AuthorColor, - ]; note.owner = user; note.userPermissions = [ { @@ -782,13 +772,6 @@ describe('NotesService', () => { note.alias = 'testAlias'; note.title = 'testTitle'; note.description = 'testDescription'; - note.authorColors = [ - { - note: note, - user: user, - color: 'red', - } as AuthorColor, - ]; note.owner = user; note.userPermissions = [ { diff --git a/src/notes/notes.service.ts b/src/notes/notes.service.ts index 149262aa3..b2df08354 100644 --- a/src/notes/notes.service.ts +++ b/src/notes/notes.service.ts @@ -60,13 +60,7 @@ export class NotesService { async getUserNotes(user: User): Promise { const notes = await this.noteRepository.find({ where: { owner: user }, - relations: [ - 'owner', - 'userPermissions', - 'groupPermissions', - 'authorColors', - 'tags', - ], + relations: ['owner', 'userPermissions', 'groupPermissions', 'tags'], }); if (notes === undefined) { return []; @@ -173,7 +167,6 @@ export class NotesService { }, ], relations: [ - 'authorColors', 'owner', 'groupPermissions', 'groupPermissions.group', @@ -365,9 +358,7 @@ export class NotesService { title: note.title ?? '', createTime: (await this.getFirstRevision(note)).createdAt, description: note.description ?? '', - editedBy: note.authorColors.map( - (authorColor) => authorColor.user.userName, - ), + editedBy: [], // TODO temporary placeholder, permissions: this.toNotePermissionsDto(note), tags: this.toTagList(note), updateTime: (await this.getLatestRevision(note)).createdAt, diff --git a/src/permissions/permissions.service.spec.ts b/src/permissions/permissions.service.spec.ts index c97ef750d..57269e903 100644 --- a/src/permissions/permissions.service.spec.ts +++ b/src/permissions/permissions.service.spec.ts @@ -9,7 +9,6 @@ import { getRepositoryToken } from '@nestjs/typeorm'; import { AuthToken } from '../auth/auth-token.entity'; import { Group } from '../groups/group.entity'; import { LoggerModule } from '../logger/logger.module'; -import { AuthorColor } from '../notes/author-color.entity'; import { Note } from '../notes/note.entity'; import { NotesModule } from '../notes/notes.module'; import { Tag } from '../notes/tag.entity'; @@ -50,8 +49,6 @@ describe('PermissionsService', () => { .useValue({}) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(Revision)) .useValue({}) .overrideProvider(getRepositoryToken(Note)) diff --git a/src/revisions/revisions.service.spec.ts b/src/revisions/revisions.service.spec.ts index 2d1226856..5c97c8a3c 100644 --- a/src/revisions/revisions.service.spec.ts +++ b/src/revisions/revisions.service.spec.ts @@ -9,7 +9,6 @@ import { getRepositoryToken } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import { NotInDBError } from '../errors/errors'; import { LoggerModule } from '../logger/logger.module'; -import { AuthorColor } from '../notes/author-color.entity'; import { Note } from '../notes/note.entity'; import { NotesModule } from '../notes/notes.module'; import { AuthToken } from '../auth/auth-token.entity'; @@ -49,8 +48,6 @@ describe('RevisionsService', () => { }) .overrideProvider(getRepositoryToken(Authorship)) .useValue({}) - .overrideProvider(getRepositoryToken(AuthorColor)) - .useValue({}) .overrideProvider(getRepositoryToken(User)) .useValue({}) .overrideProvider(getRepositoryToken(AuthToken)) diff --git a/src/seed.ts b/src/seed.ts index 96347ddec..4329d8c0a 100644 --- a/src/seed.ts +++ b/src/seed.ts @@ -12,7 +12,6 @@ import { Authorship } from './revisions/authorship.entity'; import { NoteGroupPermission } from './permissions/note-group-permission.entity'; import { NoteUserPermission } from './permissions/note-user-permission.entity'; import { Group } from './groups/group.entity'; -import { AuthorColor } from './notes/author-color.entity'; import { HistoryEntry } from './history/history-entry.entity'; import { MediaUpload } from './media/media-upload.entity'; import { Tag } from './notes/tag.entity'; @@ -33,7 +32,6 @@ createConnection({ NoteGroupPermission, NoteUserPermission, Group, - AuthorColor, HistoryEntry, MediaUpload, Tag,