Merge pull request #4560 from FinnStutzenstein/removeChatMessageClient

Remove the ChatMessage from the client
This commit is contained in:
Finn Stutzenstein 2019-04-02 13:24:55 +02:00 committed by GitHub
commit fc3098b08f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 121 deletions

View File

@ -282,8 +282,6 @@ _('Can manage the projector');
_('Can see the front page'); _('Can see the front page');
_('Can manage tags'); _('Can manage tags');
_('Can manage configuration'); _('Can manage configuration');
_('Can use the chat');
_('Can manage the chat');
_('Can manage logos and fonts'); _('Can manage logos and fonts');
_('Can see history'); _('Can see history');
// mediafiles // mediafiles

View File

@ -1,17 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { E2EImportsModule } from 'e2e-imports.module';
import { ChatMessageRepositoryService } from './chatmessage-repository.service';
describe('ChatMessageRepositoryService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [E2EImportsModule],
providers: [ChatMessageRepositoryService]
});
});
it('should be created', inject([ChatMessageRepositoryService], (service: ChatMessageRepositoryService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -1,34 +0,0 @@
import { Injectable } from '@angular/core';
import { DataStoreService } from '../../core-services/data-store.service';
import { BaseRepository } from '../base-repository';
import { CollectionStringMapperService } from '../../core-services/collectionStringMapper.service';
import { ChatMessage } from 'app/shared/models/core/chat-message';
import { ViewChatMessage } from 'app/site/common/models/view-chatmessage';
import { ViewModelStoreService } from 'app/core/core-services/view-model-store.service';
import { TranslateService } from '@ngx-translate/core';
import { DataSendService } from 'app/core/core-services/data-send.service';
@Injectable({
providedIn: 'root'
})
export class ChatMessageRepositoryService extends BaseRepository<ViewChatMessage, ChatMessage> {
public constructor(
DS: DataStoreService,
dataSend: DataSendService,
mapperService: CollectionStringMapperService,
viewModelStoreService: ViewModelStoreService,
translate: TranslateService
) {
super(DS, dataSend, mapperService, viewModelStoreService, translate, ChatMessage);
}
public getVerboseName = (plural: boolean = false) => {
return this.translate.instant(plural ? 'Chatmessages' : 'Chatmessage');
};
protected createViewModel(message: ChatMessage): ViewChatMessage {
const viewChatMessage = new ViewChatMessage(message);
viewChatMessage.getVerboseName = this.getVerboseName;
return viewChatMessage;
}
}

View File

@ -1,17 +0,0 @@
import { BaseModel } from '../base/base-model';
/**
* Representation of chat messages.
* @ignore
*/
export class ChatMessage extends BaseModel<ChatMessage> {
public static COLLECTIONSTRING = 'core/chat-message';
public id: number;
public message: string;
public timestamp: string; // TODO: Type for timestamp
public user_id: number;
public constructor(input?: any) {
super(ChatMessage.COLLECTIONSTRING, input);
}
}

View File

@ -1,18 +1,7 @@
import { AppConfig } from '../../core/app-config'; import { AppConfig } from '../../core/app-config';
import { ChatMessage } from '../../shared/models/core/chat-message';
import { ChatMessageRepositoryService } from 'app/core/repositories/common/chatmessage-repository.service';
import { ViewChatMessage } from './models/view-chatmessage';
export const CommonAppConfig: AppConfig = { export const CommonAppConfig: AppConfig = {
name: 'common', name: 'common',
models: [
{
collectionString: 'core/chat-message',
model: ChatMessage,
viewModel: ViewChatMessage,
repository: ChatMessageRepositoryService
}
],
mainMenuEntries: [ mainMenuEntries: [
{ {
route: '/', route: '/',

View File

@ -1,40 +0,0 @@
import { ChatMessage } from 'app/shared/models/core/chat-message';
import { BaseViewModel } from 'app/site/base/base-view-model';
export class ViewChatMessage extends BaseViewModel {
public static COLLECTIONSTRING = ChatMessage.COLLECTIONSTRING;
private _chatMessage: ChatMessage;
/**
* This is set by the repository
*/
public getVerboseName;
public get chatmessage(): ChatMessage {
return this._chatMessage;
}
public get id(): number {
return this.chatmessage.id;
}
public get message(): string {
return this.chatmessage.message;
}
public constructor(message?: ChatMessage) {
super(ChatMessage.COLLECTIONSTRING);
this._chatMessage = message;
}
public getTitle = () => {
return 'Chatmessage';
};
public getModel(): ChatMessage {
return this.chatmessage;
}
public updateDependencies(message: BaseViewModel): void {}
}