From 4dd0f591f40de2ec615b3ef17bd64017975284e3 Mon Sep 17 00:00:00 2001 From: Phenom Date: Fri, 15 Apr 2016 19:08:10 +0200 Subject: [PATCH] Add Clear Button on WebUI for BroadCast. --- libresapi/src/api/ChatHandler.cpp | 7 ++++++- libresapi/src/webui-src/app/chat.js | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/libresapi/src/api/ChatHandler.cpp b/libresapi/src/api/ChatHandler.cpp index 19f268a93..bf8a1972e 100644 --- a/libresapi/src/api/ChatHandler.cpp +++ b/libresapi/src/api/ChatHandler.cpp @@ -876,7 +876,12 @@ void ChatHandler::handleClearLobby(Request &req, Response &resp) { ChatLobbyId id = 0; req.mStream << makeKeyValueReference("id", id); - notifyChatCleared(ChatId(id)); + if (id !=0) { + notifyChatCleared(ChatId(id)); + } else { + //Is BroadCast + notifyChatCleared(ChatId("B")); + } resp.setOk(); } diff --git a/libresapi/src/webui-src/app/chat.js b/libresapi/src/webui-src/app/chat.js index bde0494ac..c5bd6d418 100644 --- a/libresapi/src/webui-src/app/chat.js +++ b/libresapi/src/webui-src/app/chat.js @@ -211,6 +211,26 @@ function lobby(lobbyid){ } ) ] + } else { + if (lobdt.subscribed != undefined + && lobdt.subscribed + && lobdt.is_broadcast + ) { + //set participants + particips = [ + m("div.btn", { + style: { + "text-align":"center" + }, + onclick: function (){ + rs.request("chat/clear_lobby",{ + lobbyid, + }); + m.route("/chat?lobby=" + lobbyid); + } + },"clear"), + ] + } } return [ intro,