fix: show rewards early, replace later (#5948)
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
- Bugfix: Fixed the reply button showing for inline whispers and announcements. (#5863)
|
- Bugfix: Fixed the reply button showing for inline whispers and announcements. (#5863)
|
||||||
- Bugfix: Fixed suspicious user treatment update messages not being searchable. (#5865)
|
- 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: 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: 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: Remove unneeded platform specifier for toasts. (#5914)
|
||||||
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
|
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
|
||||||
|
|||||||
@@ -2135,6 +2135,7 @@ std::pair<MessagePtrMut, HighlightAlert> MessageBuilder::makeIrcMessage(
|
|||||||
builder.appendChannelPointRewardMessage(*reward, channel->isMod(),
|
builder.appendChannelPointRewardMessage(*reward, channel->isMod(),
|
||||||
channel->isBroadcaster());
|
channel->isBroadcaster());
|
||||||
}
|
}
|
||||||
|
builder->flags.set(MessageFlag::RedeemedChannelPointReward);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.appendChannelName(channel);
|
builder.appendChannelName(channel);
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ enum class MessageSinkTrait : uint8_t {
|
|||||||
/// added to the global mentions channel when encountered.
|
/// added to the global mentions channel when encountered.
|
||||||
AddMentionsToGlobalChannel = 1 << 0,
|
AddMentionsToGlobalChannel = 1 << 0,
|
||||||
|
|
||||||
/// A channel-point redemption whose reward is not yet known should not be
|
/// A channel-point redemption whose reward is not yet known should be
|
||||||
/// added to this sink, but queued in the corresponding TwitchChannel
|
/// queued in the corresponding TwitchChannel (`addQueuedRedemption`) and
|
||||||
/// (`addQueuedRedemption`).
|
/// the message should be replaced later.
|
||||||
RequiresKnownChannelPointReward = 1 << 1,
|
RequiresKnownChannelPointReward = 1 << 1,
|
||||||
};
|
};
|
||||||
using MessageSinkTraits = FlagsEnum<MessageSinkTrait>;
|
using MessageSinkTraits = FlagsEnum<MessageSinkTrait>;
|
||||||
|
|||||||
@@ -1010,7 +1010,6 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *message,
|
|||||||
"callback since reward is not known:"
|
"callback since reward is not known:"
|
||||||
<< rewardId;
|
<< rewardId;
|
||||||
chan->addQueuedRedemption(rewardId, originalContent, message);
|
chan->addQueuedRedemption(rewardId, originalContent, message);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
args.channelPointRewardId = rewardId;
|
args.channelPointRewardId = rewardId;
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
#include "util/Helpers.hpp"
|
#include "util/Helpers.hpp"
|
||||||
#include "util/PostToThread.hpp"
|
#include "util/PostToThread.hpp"
|
||||||
#include "util/QStringHash.hpp"
|
#include "util/QStringHash.hpp"
|
||||||
|
#include "util/VectorMessageSink.hpp"
|
||||||
#include "widgets/Window.hpp"
|
#include "widgets/Window.hpp"
|
||||||
|
|
||||||
#include <IrcConnection>
|
#include <IrcConnection>
|
||||||
@@ -460,9 +461,24 @@ void TwitchChannel::addChannelPointReward(const ChannelPointReward &reward)
|
|||||||
[&](const QueuedRedemption &msg) {
|
[&](const QueuedRedemption &msg) {
|
||||||
if (reward.id == msg.rewardID)
|
if (reward.id == msg.rewardID)
|
||||||
{
|
{
|
||||||
|
VectorMessageSink sink(
|
||||||
|
MessageSinkTrait::AddMentionsToGlobalChannel);
|
||||||
IrcMessageHandler::instance().addMessage(
|
IrcMessageHandler::instance().addMessage(
|
||||||
msg.message.get(), *this, this, msg.originalContent,
|
msg.message.get(), sink, this, msg.originalContent,
|
||||||
*server, false, false);
|
*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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
"url": ""
|
"url": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"flags": "Collapsed",
|
"flags": "Collapsed|RedeemedChannelPointReward",
|
||||||
"id": "4d409401-f692-4dd1-9295-f21350f86860",
|
"id": "4d409401-f692-4dd1-9295-f21350f86860",
|
||||||
"localizedName": "",
|
"localizedName": "",
|
||||||
"loginName": "nerixyz",
|
"loginName": "nerixyz",
|
||||||
|
|||||||
Reference in New Issue
Block a user