@ -314,35 +314,38 @@ TimelineViewManager::queueEmoteMessage(const QString &msg)
}
}
void
void
TimelineViewManager : : reactToMessage ( const QString & roomId ,
TimelineViewManager : : queueReactionMessage ( const QString & reactedEvent , const QString & reactionKey )
const QString & reactedEvent ,
const QString & reactionKey ,
const QString & selfReactedEvent )
{
{
if ( ! timeline_ )
return ;
auto reactions = timeline_ - > reactions ( reactedEvent . toStdString ( ) ) ;
QString selfReactedEvent ;
for ( const auto & reaction : reactions ) {
if ( reactionKey = = reaction . key_ ) {
selfReactedEvent = reaction . selfReactedEvent_ ;
break ;
}
}
if ( selfReactedEvent . startsWith ( " m " ) )
return ;
// If selfReactedEvent is empty, that means we haven't previously reacted
// If selfReactedEvent is empty, that means we haven't previously reacted
if ( selfReactedEvent . isEmpty ( ) ) {
if ( selfReactedEvent . isEmpty ( ) ) {
queueReactionMessage ( roomId , reactedEvent , reactionKey ) ;
mtx : : events : : msg : : Reaction reaction ;
reaction . relates_to . rel_type = mtx : : common : : RelationType : : Annotation ;
reaction . relates_to . event_id = reactedEvent . toStdString ( ) ;
reaction . relates_to . key = reactionKey . toStdString ( ) ;
timeline_ - > sendMessage ( reaction ) ;
// Otherwise, we have previously reacted and the reaction should be redacted
// Otherwise, we have previously reacted and the reaction should be redacted
} else {
} else {
auto model = models . value ( roomId ) ;
timeline_ - > redactEvent ( selfReactedEvent ) ;
model - > redactEvent ( selfReactedEvent ) ;
}
}
}
}
void
TimelineViewManager : : queueReactionMessage ( const QString & roomId ,
const QString & reactedEvent ,
const QString & reactionKey )
{
mtx : : events : : msg : : Reaction reaction ;
reaction . relates_to . rel_type = mtx : : common : : RelationType : : Annotation ;
reaction . relates_to . event_id = reactedEvent . toStdString ( ) ;
reaction . relates_to . key = reactionKey . toStdString ( ) ;
auto model = models . value ( roomId ) ;
model - > sendMessage ( reaction ) ;
}
void
void
TimelineViewManager : : queueImageMessage ( const QString & roomid ,
TimelineViewManager : : queueImageMessage ( const QString & roomid ,
const QString & filename ,
const QString & filename ,