diff --git a/ChangeLog.md b/ChangeLog.md index 2f3f13cf..15447328 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,4 +1,7 @@ # Changelog: +* **04.10.20** + - Fixed invalid channel tree unique id assignment for the initial server entry ([#F2986](https://forum.teaspeak.de/index.php?threads/2986)) + * **27.09.20** - Middle clicking on bookmarks now directly connects in a new tab diff --git a/shared/js/tree/Channel.ts b/shared/js/tree/Channel.ts index c32c1d45..2a6111d2 100644 --- a/shared/js/tree/Channel.ts +++ b/shared/js/tree/Channel.ts @@ -73,7 +73,7 @@ export class ChannelProperties { //Only after request channel_description: string = ""; - channel_flag_conversation_private: boolean = true; /* TeamSpeak mode */ + channel_conversation_mode: number = 0; /* 0 := Private, the default */ channel_conversation_history_length: number = -1; } @@ -594,6 +594,10 @@ export class ChannelEntry extends ChannelTreeEntry { this._cached_channel_description_promise = undefined; this._cached_channel_description_promise_resolve = undefined; this._cached_channel_description_promise_reject = undefined; + } else if(key === "channel_flag_conversation_private") { + /* "fix" for older TeaSpeak server versions (pre. 1.4.22) */ + this.properties.channel_conversation_mode = value === "1" ? 0 : 1; + variables.push({ key: "channel_conversation_mode", value: this.properties.channel_conversation_mode + "" }); } } /* devel-block(log-channel-property-updates) */ diff --git a/shared/js/tree/Client.ts b/shared/js/tree/Client.ts index 2ca4369b..1b8b75ca 100644 --- a/shared/js/tree/Client.ts +++ b/shared/js/tree/Client.ts @@ -1233,8 +1233,9 @@ export class MusicClientEntry extends ClientEntry { name: tr("Change remote volume"), callback: () => { let max_volume = this.channelTree.client.permissions.neededPermission(PermissionType.I_CLIENT_MUSIC_CREATE_MODIFY_MAX_VOLUME).value; - if(max_volume < 0) + if(max_volume < 0) { max_volume = 100; + } spawnMusicBotVolumeChange(this, max_volume / 100); } diff --git a/shared/js/ui/frames/log/DispatcherLog.scss b/shared/js/ui/frames/log/DispatcherLog.scss index ac0b0014..d10b389f 100644 --- a/shared/js/ui/frames/log/DispatcherLog.scss +++ b/shared/js/ui/frames/log/DispatcherLog.scss @@ -1,5 +1,3 @@ .clientEntry, .channelEntry { color: var(--server-log-tree-entry); - font-weight: 700; - cursor: pointer; } \ No newline at end of file diff --git a/shared/js/ui/frames/log/DispatcherLog.tsx b/shared/js/ui/frames/log/DispatcherLog.tsx index a792a6e2..bf7bc5c3 100644 --- a/shared/js/ui/frames/log/DispatcherLog.tsx +++ b/shared/js/ui/frames/log/DispatcherLog.tsx @@ -7,6 +7,7 @@ import {BBCodeRenderer} from "tc-shared/text/bbcode"; import {format_time} from "tc-shared/ui/frames/chat"; import {CommandResult} from "tc-shared/connection/ServerConnectionDeclaration"; import {XBBCodeRenderer} from "vendor/xbbcode/react"; +import {ChannelTag, ClientTag} from "tc-shared/ui/tree/EntryTags"; const cssStyle = require("./DispatcherLog.scss"); const cssStyleRenderer = require("./Renderer.scss"); @@ -26,18 +27,23 @@ export function getRegisteredLogDispatchers() : TypeInfo[] { return Object.keys(dispatchers) as any; } -/* TODO: Enable context menu */ const ClientRenderer = (props: { client: EventClient, handlerId: string, braces?: boolean }) => ( -
- {props.client.client_name} -
+ ); -/* TODO: Enable context menu */ const ChannelRenderer = (props: { channel: EventChannelData, handlerId: string, braces?: boolean }) => ( -
- {props.channel.channel_name} -
+ ); registerDispatcher(EventType.ERROR_CUSTOM, data =>
{data.message}
); diff --git a/shared/js/ui/frames/side/AbstractConversion.ts b/shared/js/ui/frames/side/AbstractConversion.ts index 4b4a937c..1322defb 100644 --- a/shared/js/ui/frames/side/AbstractConversion.ts +++ b/shared/js/ui/frames/side/AbstractConversion.ts @@ -62,10 +62,11 @@ export abstract class AbstractChat { this.hasHistory = true; index -= deleteMessageCount; - if(event.isOwnMessage) + if(event.isOwnMessage) { this.setUnreadTimestamp(undefined); - else if(!this.unreadTimestamp) + } else if(!this.unreadTimestamp) { this.setUnreadTimestamp(event.message.timestamp); + } /* let all other events run before */ this.events.fire_async("notify_chat_event", { @@ -333,10 +334,11 @@ export abstract class AbstractChatManager { return; } - if(conversation.currentMode() === "unloaded") + if(conversation.currentMode() === "unloaded") { conversation.queryCurrentMessages(); - else + } else { conversation.reportStateToUI(); + } } @EventHandler("query_conversation_history") diff --git a/shared/js/ui/frames/side/ConversationManager.ts b/shared/js/ui/frames/side/ConversationManager.ts index 40dd86eb..070c4b03 100644 --- a/shared/js/ui/frames/side/ConversationManager.ts +++ b/shared/js/ui/frames/side/ConversationManager.ts @@ -49,14 +49,17 @@ export class Conversation extends AbstractChat { cid: this.conversationId } as any; - if(typeof criteria.begin === "number") + if(typeof criteria.begin === "number") { requestObject.timestamp_begin = criteria.begin; + } - if(typeof criteria.end === "number") + if(typeof criteria.end === "number") { requestObject.timestamp_end = criteria.end; + } - if(typeof criteria.limit === "number") + if(typeof criteria.limit === "number") { requestObject.message_count = criteria.limit; + } return this.handle.connection.serverConnection.send_command("conversationhistory", requestObject, { flagset: [ "merge" ], process_result: false }).then(() => { resolve({ status: "success", events: this.historyQueryResponse.map(e => { @@ -198,11 +201,13 @@ export class Conversation extends AbstractChat { } const timestamp = parseInt(info["timestamp"]); - if(isNaN(timestamp)) + if(isNaN(timestamp)) { return; + } - if(timestamp > this.lastReadMessage) + if(timestamp > this.lastReadMessage) { this.setUnreadTimestamp(this.lastReadMessage); + } } public handleIncomingMessage(message: ChatMessage, isOwnMessage: boolean) { @@ -277,7 +282,7 @@ export class Conversation extends AbstractChat { } sendMessage(text: string) { - this.doSendMessage(text, this.conversationId ? 2 : 3, this.conversationId); + this.doSendMessage(text, this.conversationId ? 2 : 3, this.conversationId).then(() => {}); } } @@ -344,7 +349,7 @@ export class ConversationManager extends AbstractChatManager { + this.uiEvents.on("notify_destroy", this.connection.channelTree.events.on("notify_channel_updated", _event => { /* TODO private flag! */ })); } @@ -403,9 +408,6 @@ export class ConversationManager extends AbstractChatManager { return { cid: e.channelId, cpw: e.cached_password() }}); this.connection.serverConnection.send_command("conversationfetch", commandData).catch(error => { log.warn(LogCategory.CHAT, tr("Failed to query conversation indexes: %o"), error); @@ -465,7 +467,7 @@ export class ConversationManager extends AbstractChatManager("query_selected_chat") - private handleQuerySelectedChat(event: ConversationUIEvents["query_selected_chat"]) { + private handleQuerySelectedChat() { this.uiEvents.fire_async("notify_selected_chat", { chatId: isNaN(this.selectedConversation_) ? "unselected" : this.selectedConversation_ + ""}) } diff --git a/shared/js/ui/frames/side/ConversationUI.tsx b/shared/js/ui/frames/side/ConversationUI.tsx index 559d1027..b1a06ea3 100644 --- a/shared/js/ui/frames/side/ConversationUI.tsx +++ b/shared/js/ui/frames/side/ConversationUI.tsx @@ -22,10 +22,14 @@ import {TimestampRenderer} from "tc-shared/ui/react-elements/TimestampRenderer"; import {BBCodeRenderer} from "tc-shared/text/bbcode"; import {getGlobalAvatarManagerFactory} from "tc-shared/file/Avatars"; import {ColloquialFormat, date_format, format_date_general, formatDayTime} from "tc-shared/utils/DateUtils"; +import {ClientTag} from "tc-shared/ui/tree/EntryTags"; const cssStyle = require("./ConversationUI.scss"); -const CMTextRenderer = React.memo((props: { text: string }) => ); +const ChatMessageTextRenderer = React.memo((props: { text: string }) => { + if(typeof props.text !== "string") { debugger; } + return ; +}); const ChatEventMessageRenderer = React.memo((props: { message: ChatMessage, @@ -57,17 +61,8 @@ const ChatEventMessageRenderer = React.memo((props: { @@ -481,7 +476,7 @@ class ConversationMessages extends React.PureComponent You don't have permissions to participate in this conversation!
- >{this.state.failedPermission}
+ {this.state.failedPermission} ); break; diff --git a/shared/js/ui/frames/side/PrivateConversationUI.tsx b/shared/js/ui/frames/side/PrivateConversationUI.tsx index 8518583d..3faadae7 100644 --- a/shared/js/ui/frames/side/PrivateConversationUI.tsx +++ b/shared/js/ui/frames/side/PrivateConversationUI.tsx @@ -72,8 +72,9 @@ const ConversationEntryInfo = React.memo((props: { events: Registry { - if(!isTyping) + if(!isTyping) { return; + } const timeout = setTimeout(() => { setTypingTimestamp(0); diff --git a/shared/js/ui/modal/ModalBanClient.ts b/shared/js/ui/modal/ModalBanClient.ts index c94fe447..2fab80e2 100644 --- a/shared/js/ui/modal/ModalBanClient.ts +++ b/shared/js/ui/modal/ModalBanClient.ts @@ -75,13 +75,16 @@ export function spawnBanClient(client: ConnectionHandler, entries: BanEntry | Ba input_duration_value.firstParent(".input-boxed").removeClass("is-invalid"); } - if (max != -1) + if (max != -1) { tooltip_duration_max.html(tr("You're allowed to ban a maximum of ") + "" + max + " " + duration_data[type][max == 1 ? "1-text" : "text"] + ""); - else + } else { tooltip_duration_max.html(tr("You're allowed to ban permanent.")); + } } else { - if (value && !Number.isNaN(value)) + if (value && !Number.isNaN(value)) { input_duration_value.attr("x-saved-value", value); + } + input_duration_value.attr("placeholder", tr("for ever")).val(null); tooltip_duration_max.html(tr("You're allowed to ban permanent.")); } diff --git a/shared/js/ui/tree/EntryTags.scss b/shared/js/ui/tree/EntryTags.scss new file mode 100644 index 00000000..c739350f --- /dev/null +++ b/shared/js/ui/tree/EntryTags.scss @@ -0,0 +1,6 @@ +.client { + display: inline-block; + color: #D8D8D8; + font-weight: 700; + cursor: pointer; +} \ No newline at end of file diff --git a/shared/js/ui/tree/EntryTags.tsx b/shared/js/ui/tree/EntryTags.tsx new file mode 100644 index 00000000..bed7617c --- /dev/null +++ b/shared/js/ui/tree/EntryTags.tsx @@ -0,0 +1,23 @@ +import * as React from "react"; + +const cssStyle = require("./EntryTags.scss"); + +export const ClientTag = (props: { clientName: string, clientUniqueId: string, handlerId: string, clientId?: number, clientDatabaseId?: number, className?: string }) => { + + return ( +
{ + event.preventDefault(); + + /* TODO: Enable context menus */ + }} + > + {props.clientName} +
+ ); +}; + +export const ChannelTag = (props: { channelName: string, channelId: number, handlerId: string, className?: string }) => { + + return
{props.channelName}
; +}; \ No newline at end of file diff --git a/web/app/audio-lib/index.ts b/web/app/audio-lib/index.ts index ee024781..30a4b8a0 100644 --- a/web/app/audio-lib/index.ts +++ b/web/app/audio-lib/index.ts @@ -20,7 +20,7 @@ export class AudioLibrary { this.worker = new WorkerOwner(AudioLibrary.spawnNewWorker); } - private static spawnNewWorker() { + private static spawnNewWorker() : Worker { /* * Attention don't use () => new Worker(...). * This confuses the worker plugin and will not emit any modules