Stop whispers from showing up in /mentions unless they match another highlight (#4389)

This commit is contained in:
pajlada
2023-02-18 13:02:12 +01:00
committed by GitHub
parent da97079877
commit 2629e3baa7
3 changed files with 53 additions and 1 deletions
+51
View File
@@ -3,6 +3,7 @@
#include "Application.hpp"
#include "BaseSettings.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/highlights/HighlightPhrase.hpp"
#include "messages/MessageBuilder.hpp" // for MessageParseArgs
#include "mocks/UserData.hpp"
#include "providers/twitch/api/Helix.hpp"
@@ -774,6 +775,56 @@ TEST_F(HighlightControllerTest, A)
},
},
},
{
// TEST CASE: Whispers that do not hit a highlight phrase should not be added to /mentions
{
// input
.args =
MessageParseArgs{
.isReceivedWhisper = true,
},
.senderName = "forsen",
.originalMessage = "Hello NymN!",
},
{
// expected
.state = true, // state
.result =
{
false, // alert
false, // playsound
boost::none, // custom sound url
std::make_shared<QColor>(
HighlightPhrase::
FALLBACK_HIGHLIGHT_COLOR), // color
false, // showInMentions
},
},
},
{
// TEST CASE: Whispers that do hit a highlight phrase should be added to /mentions
{
// input
.args =
MessageParseArgs{
.isReceivedWhisper = true,
},
.senderName = "forsen",
.originalMessage = "!testmanxd",
},
{
// expected
.state = true, // state
.result =
{
true, // alert
true, // playsound
boost::none, // custom sound url
std::make_shared<QColor>("#7f7f3f49"), // color
true, // showInMentions
},
},
},
};
for (const auto &[input, expected] : tests)