polfan-server-js-client 0.2.31 → 0.2.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { User } from "./User";
2
2
  import { ChatLocation } from "./ChatLocation";
3
- export type MessageType = 'Text' | 'RoomJoin' | 'RoomLeave' | 'SpaceJoin' | 'SpaceLeave' | 'TopicChange' | 'CustomNickChange';
3
+ export type MessageType = 'Text' | 'RoomJoin' | 'RoomLeave' | 'SpaceJoin' | 'SpaceLeave' | 'TopicChange' | 'CustomNickChange' | 'System';
4
4
  export interface MessageAuthor {
5
5
  user: User;
6
6
  customNick?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polfan-server-js-client",
3
- "version": "0.2.31",
3
+ "version": "0.2.33",
4
4
  "description": "JavaScript client library for handling communication with Polfan chat server.",
5
5
  "author": "Jarosław Żak",
6
6
  "license": "MIT",
@@ -8,7 +8,7 @@ import {
8
8
  RoomDeleted,
9
9
  RoomLeft,
10
10
  TopicDeleted,
11
- FollowedTopicUpdated, RoomJoined, NewTopic, Session, Room,
11
+ FollowedTopicUpdated, RoomJoined, NewTopic, Session, Room, MessageType,
12
12
  } from "../types/src";
13
13
  import {
14
14
  IndexedCollection,
@@ -209,9 +209,10 @@ export class MessagesManager {
209
209
  private updateLocallyFollowedTopicOnNewMessage(ev: NewMessage): void {
210
210
  const roomFollowedTopics = this.followedTopics.get(ev.message.location.roomId);
211
211
  const followedTopic = roomFollowedTopics?.get(ev.message.location.topicId);
212
+ const ephemeralMessageTypes = ['System'] as MessageType[];
212
213
 
213
- if (! roomFollowedTopics || ! followedTopic) {
214
- // Skip if we don't follow this room or targeted topic
214
+ if (!roomFollowedTopics || !followedTopic || ephemeralMessageTypes.includes(ev.message.type)) {
215
+ // Skip if we don't follow this room or targeted topic or message is ephemeral
215
216
  return;
216
217
  }
217
218
 
@@ -1,7 +1,7 @@
1
1
  import {User} from "./User";
2
2
  import {ChatLocation} from "./ChatLocation";
3
3
 
4
- export type MessageType = 'Text'|'RoomJoin'|'RoomLeave'|'SpaceJoin'|'SpaceLeave'|'TopicChange'|'CustomNickChange';
4
+ export type MessageType = 'Text'|'RoomJoin'|'RoomLeave'|'SpaceJoin'|'SpaceLeave'|'TopicChange'|'CustomNickChange'|'System';
5
5
 
6
6
  export interface MessageAuthor {
7
7
  user: User;