Merge pull request #31 from yardstick/feature/QUANT-953
QUANT-953: remove `CustomChannel`
This commit is contained in:
commit
3b723cbad6
@ -1,4 +1,4 @@
|
||||
# BRAID v1.3.0
|
||||
# BRAID v1.3.1
|
||||
> Websocket server for the Measure platform
|
||||
|
||||
[](https://semaphoreci.com/yardstick/braid)
|
||||
|
@ -1 +1 @@
|
||||
1.3.0
|
||||
1.3.1
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "braid",
|
||||
"version": "1.2.3",
|
||||
"version": "1.2.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "braid",
|
||||
"version": "1.2.2",
|
||||
"version": "1.3.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import PublicChannel from './channels/types/publicChannel';
|
||||
import PrivateChannel from './channels/types/privateChannel';
|
||||
import CustomChannel from './channels/types/customChannel';
|
||||
import PublicClient from './clients/types/publicClient';
|
||||
import PrivateClient from './clients/types/privateClient';
|
||||
import CustomClient from './clients/types/customClient';
|
||||
@ -17,8 +16,8 @@ class ChannelManager {
|
||||
}
|
||||
|
||||
createChannel(data: any) {
|
||||
const channelExists: PublicChannel|PrivateChannel|CustomChannel|null = this.channelExists(data.channel);
|
||||
let channel: PublicChannel|PrivateChannel|CustomChannel;
|
||||
const channelExists: PublicChannel|PrivateChannel|null = this.channelExists(data.channel);
|
||||
let channel: PublicChannel|PrivateChannel;
|
||||
|
||||
if (channelExists) {
|
||||
channel = channelExists;
|
||||
@ -43,7 +42,7 @@ class ChannelManager {
|
||||
}
|
||||
|
||||
addClientToChannel(client: PublicClient|PrivateClient|CustomClient, channel_id: string) {
|
||||
const channel: PrivateChannel|PrivateChannel|CustomChannel|null = this.channelExists(channel_id);
|
||||
const channel: PrivateChannel|PrivateChannel|null = this.channelExists(channel_id);
|
||||
|
||||
if (channel) {
|
||||
channel.addClient(client);
|
||||
@ -54,7 +53,7 @@ class ChannelManager {
|
||||
}
|
||||
}
|
||||
|
||||
updateChannelContent(channel: PrivateChannel|PrivateChannel|CustomChannel, channelContent: JSON) {
|
||||
updateChannelContent(channel: PrivateChannel|PrivateChannel, channelContent: JSON) {
|
||||
if (channel) {
|
||||
channel.channelContent = channelContent;
|
||||
return {status: 'success'};
|
||||
@ -70,12 +69,10 @@ class ChannelManager {
|
||||
`attempting to create channel of type ${data.channel_type}, channel id: ${data.channel}...`
|
||||
);
|
||||
|
||||
if (data.channel_type === 'public') {
|
||||
return new PublicChannel(data.channel);
|
||||
} else if (data.channel_type === 'private') {
|
||||
if (data.channel_type === 'private') {
|
||||
return new PrivateChannel(data.channel);
|
||||
} else {
|
||||
return new CustomChannel(data.channel, data.custom);
|
||||
return new PublicChannel(data.channel);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
@ -1,18 +0,0 @@
|
||||
import CustomClient from '../../clients/types/customClient';
|
||||
import ChannelBase from '../channelBase';
|
||||
|
||||
class CustomChannel extends ChannelBase {
|
||||
clients: CustomClient[] = [];
|
||||
|
||||
constructor(id: string, custom: any) {
|
||||
super(id);
|
||||
|
||||
if (custom) {
|
||||
this.broadcastConditions = custom.broadcastConditions;
|
||||
this.channelContent = custom.channelContent;
|
||||
this.explicitRemoval = custom.explicitRemoval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default CustomChannel;
|
@ -3,7 +3,6 @@ import ClientManager from '../clientManager';
|
||||
import ChannelManager from '../channelManager';
|
||||
import PublicChannel from '../channels/types/publicChannel';
|
||||
import PrivateChannel from '../channels/types/privateChannel';
|
||||
import CustomChannel from '../channels/types/customChannel';
|
||||
|
||||
const messageManager = require('../messageManager');
|
||||
const logger = require('../logger');
|
||||
@ -12,7 +11,7 @@ class ClientBase {
|
||||
ws: WebSocket;
|
||||
data: any;
|
||||
id: number;
|
||||
channel: PublicChannel|PrivateChannel|CustomChannel|null;
|
||||
channel: PublicChannel|PrivateChannel|null;
|
||||
clientManager: ClientManager;
|
||||
channelManager: ChannelManager;
|
||||
roles: string[];
|
||||
@ -68,7 +67,7 @@ class ClientBase {
|
||||
return this.data.client;
|
||||
}
|
||||
|
||||
connectToChannel(channel: PublicChannel|PrivateChannel|CustomChannel) {
|
||||
connectToChannel(channel: PublicChannel|PrivateChannel) {
|
||||
this.channel = channel;
|
||||
this.ws.on('message', this.messageListener);
|
||||
this.ws.on('close', this.closeListener);
|
||||
|
Loading…
x
Reference in New Issue
Block a user