Refactor action definition
- Make an empty message type optional mean "no message" - Set message type for all actions that send a message through the normal mechanism - Remove now redundant bool specifying whether a message should be sent
This commit is contained in:
@@ -309,7 +309,7 @@ void ChatBarCache::postMessage()
|
||||
}
|
||||
|
||||
const auto result = ActionsModel::handleAction(room, this);
|
||||
if (!result.first.has_value()) {
|
||||
if (!result.second.has_value()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -338,8 +338,7 @@ void ChatBarCache::postMessage()
|
||||
relatesTo = Quotient::EventRelation::replyTo(replyId());
|
||||
}
|
||||
|
||||
const auto type = std::get<std::optional<Quotient::RoomMessageEvent::MsgType>>(result);
|
||||
room->post<Quotient::RoomMessageEvent>(text(), type ? *type : Quotient::RoomMessageEvent::MsgType::Text, std::move(content), relatesTo);
|
||||
room->post<Quotient::RoomMessageEvent>(text(), *std::get<std::optional<Quotient::RoomMessageEvent::MsgType>>(result), std::move(content), relatesTo);
|
||||
clearCache();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user