Fix highlights not showing in mentions (#3801)
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@
|
|||||||
- Bugfix: Fixed automod queue pubsub topic persisting after user change. (#3718)
|
- Bugfix: Fixed automod queue pubsub topic persisting after user change. (#3718)
|
||||||
- Bugfix: Fixed viewer list not closing after pressing escape key. (#3734)
|
- Bugfix: Fixed viewer list not closing after pressing escape key. (#3734)
|
||||||
- Bugfix: Fixed links with no thumbnail having previous link's thumbnail. (#3720)
|
- Bugfix: Fixed links with no thumbnail having previous link's thumbnail. (#3720)
|
||||||
- Dev: Overhaul highlight system by moving all checks into a Controller allowing for easier tests. (#3399)
|
- Dev: Overhaul highlight system by moving all checks into a Controller allowing for easier tests. (#3399, #3801)
|
||||||
- Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662)
|
- Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662)
|
||||||
- Dev: Batch checking live status for all channels after startup. (#3757, #3762, #3767)
|
- Dev: Batch checking live status for all channels after startup. (#3757, #3762, #3767)
|
||||||
|
|
||||||
|
|||||||
@@ -44,12 +44,57 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MockApplication : BaseApplication
|
class MockApplication : IApplication
|
||||||
{
|
{
|
||||||
AccountController *const getAccounts() override
|
public:
|
||||||
|
Theme *getThemes() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
Fonts *getFonts() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
Emotes *getEmotes() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
AccountController *getAccounts() override
|
||||||
{
|
{
|
||||||
return &this->accounts;
|
return &this->accounts;
|
||||||
}
|
}
|
||||||
|
HotkeyController *getHotkeys() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
WindowManager *getWindows() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
Toasts *getToasts() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
CommandController *getCommands() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
NotificationController *getNotifications() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
TwitchIrcServer *getTwitch() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
ChatterinoBadges *getChatterinoBadges() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
FfzBadges *getFfzBadges() override
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
AccountController accounts;
|
AccountController accounts;
|
||||||
// TODO: Figure this out
|
// TODO: Figure this out
|
||||||
|
|||||||
@@ -170,11 +170,9 @@ void rebuildUserHighlights(Settings &settings,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return HighlightResult{
|
return HighlightResult{
|
||||||
highlight.hasAlert(),
|
highlight.hasAlert(), highlight.hasSound(),
|
||||||
highlight.hasSound(),
|
highlightSoundUrl, highlight.getColor(),
|
||||||
highlightSoundUrl,
|
highlight.showInMentions(),
|
||||||
highlight.getColor(),
|
|
||||||
false, // showInMentions
|
|
||||||
};
|
};
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
@@ -344,6 +342,14 @@ std::pair<bool, HighlightResult> HighlightController::check(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkResult->showInMentions)
|
||||||
|
{
|
||||||
|
if (!result.showInMentions)
|
||||||
|
{
|
||||||
|
result.showInMentions = checkResult->showInMentions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result.full())
|
if (result.full())
|
||||||
{
|
{
|
||||||
// The final highlight result does not have room to add any more parameters, early out
|
// The final highlight result does not have room to add any more parameters, early out
|
||||||
|
|||||||
@@ -121,6 +121,22 @@ struct HighlightResult {
|
|||||||
this->customSoundUrl.has_value() && this->color &&
|
this->customSoundUrl.has_value() && this->color &&
|
||||||
this->showInMentions;
|
this->showInMentions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend std::ostream &operator<<(std::ostream &os,
|
||||||
|
const HighlightResult &result)
|
||||||
|
{
|
||||||
|
os << "Alert: " << (result.alert ? "Yes" : "No") << ", "
|
||||||
|
<< "Play sound: " << (result.playSound ? "Yes" : "No") << " ("
|
||||||
|
<< (result.customSoundUrl
|
||||||
|
? result.customSoundUrl.get().toString().toStdString()
|
||||||
|
: "")
|
||||||
|
<< ")"
|
||||||
|
<< ", "
|
||||||
|
<< "Color: "
|
||||||
|
<< (result.color ? result.color->name().toStdString() : "") << ", "
|
||||||
|
<< "Show in mentions: " << (result.showInMentions ? "Yes" : "No");
|
||||||
|
return os;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HighlightCheck {
|
struct HighlightCheck {
|
||||||
|
|||||||
@@ -451,6 +451,47 @@ TEST_F(HighlightControllerTest, A)
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// User mention with showInMentions
|
||||||
|
{
|
||||||
|
// input
|
||||||
|
MessageParseArgs{}, // no special args
|
||||||
|
{}, // no badges
|
||||||
|
"gempir", // sender name
|
||||||
|
"a", // original message
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// expected
|
||||||
|
true, // state
|
||||||
|
{
|
||||||
|
true, // alert
|
||||||
|
false, // playsound
|
||||||
|
boost::none, // custom sound url
|
||||||
|
std::make_shared<QColor>("#7ff19900"), // color
|
||||||
|
true, // showInMentions
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{
|
||||||
|
// input
|
||||||
|
MessageParseArgs{}, // no special args
|
||||||
|
{}, // no badges
|
||||||
|
"a", // sender name
|
||||||
|
"!testmanxd", // original message
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// expected
|
||||||
|
true, // state
|
||||||
|
{
|
||||||
|
true, // alert
|
||||||
|
true, // playsound
|
||||||
|
boost::none, // custom sound url
|
||||||
|
std::make_shared<QColor>("#7f7f3f49"), // color
|
||||||
|
true, // showInMentions
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto &[input, expected] : tests)
|
for (const auto &[input, expected] : tests)
|
||||||
|
|||||||
Reference in New Issue
Block a user