fix: show rewards early, replace later (#5948)

This commit is contained in:
nerix
2025-02-10 22:12:30 +01:00
committed by GitHub
parent 9527421bcd
commit 2b118c9aa2
6 changed files with 23 additions and 6 deletions
+1
View File
@@ -22,6 +22,7 @@
- Bugfix: Fixed the reply button showing for inline whispers and announcements. (#5863)
- Bugfix: Fixed suspicious user treatment update messages not being searchable. (#5865)
- Bugfix: Ensure miniaudio backend exits even if it doesn't exit cleanly. (#5896)
- Bugfix: Fixed channel point redemptions with messages not showing up if PubSub is disconnected. (#5948)
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943)
- Dev: Remove unneeded platform specifier for toasts. (#5914)
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
+1
View File
@@ -2135,6 +2135,7 @@ std::pair<MessagePtrMut, HighlightAlert> MessageBuilder::makeIrcMessage(
builder.appendChannelPointRewardMessage(*reward, channel->isMod(),
channel->isBroadcaster());
}
builder->flags.set(MessageFlag::RedeemedChannelPointReward);
}
builder.appendChannelName(channel);
+3 -3
View File
@@ -22,9 +22,9 @@ enum class MessageSinkTrait : uint8_t {
/// added to the global mentions channel when encountered.
AddMentionsToGlobalChannel = 1 << 0,
/// A channel-point redemption whose reward is not yet known should not be
/// added to this sink, but queued in the corresponding TwitchChannel
/// (`addQueuedRedemption`).
/// A channel-point redemption whose reward is not yet known should be
/// queued in the corresponding TwitchChannel (`addQueuedRedemption`) and
/// the message should be replaced later.
RequiresKnownChannelPointReward = 1 << 1,
};
using MessageSinkTraits = FlagsEnum<MessageSinkTrait>;
@@ -1010,7 +1010,6 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *message,
"callback since reward is not known:"
<< rewardId;
chan->addQueuedRedemption(rewardId, originalContent, message);
return;
}
args.channelPointRewardId = rewardId;
+17 -1
View File
@@ -44,6 +44,7 @@
#include "util/Helpers.hpp"
#include "util/PostToThread.hpp"
#include "util/QStringHash.hpp"
#include "util/VectorMessageSink.hpp"
#include "widgets/Window.hpp"
#include <IrcConnection>
@@ -460,9 +461,24 @@ void TwitchChannel::addChannelPointReward(const ChannelPointReward &reward)
[&](const QueuedRedemption &msg) {
if (reward.id == msg.rewardID)
{
VectorMessageSink sink(
MessageSinkTrait::AddMentionsToGlobalChannel);
IrcMessageHandler::instance().addMessage(
msg.message.get(), *this, this, msg.originalContent,
msg.message.get(), sink, this, msg.originalContent,
*server, false, false);
if (sink.messages().empty())
{
return true;
}
MessagePtr next = sink.messages().back();
auto prev = this->findMessageByID(next->id);
if (!prev)
{
// message gone
this->addMessage(next, MessageContext::Repost);
return true;
}
this->replaceMessage(prev, next);
return true;
}
return false;
@@ -109,7 +109,7 @@
"url": ""
}
],
"flags": "Collapsed",
"flags": "Collapsed|RedeemedChannelPointReward",
"id": "4d409401-f692-4dd1-9295-f21350f86860",
"localizedName": "",
"loginName": "nerixyz",