Do not emit new message if it is a state event.

This commit is contained in:
Black Hat 2018-11-21 19:52:26 +08:00
parent 9ad062ca30
commit 3ec1cf71bf
3 changed files with 14 additions and 5 deletions

View File

@ -69,6 +69,8 @@ ColumnLayout {
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 1 Layout.preferredHeight: 1
Layout.leftMargin: 12
Layout.rightMargin: 12
color: MSettings.darkTheme ? "#424242" : "#e7ebeb" color: MSettings.darkTheme ? "#424242" : "#e7ebeb"
} }

View File

@ -114,6 +114,8 @@ Control {
Layout.fillWidth: true Layout.fillWidth: true
Layout.margins: 8 Layout.margins: 8
id: replyItem
visible: isReply visible: isReply
spacing: 8 spacing: 8
@ -145,14 +147,18 @@ Control {
textArea: inputField textArea: inputField
emojiModel: EmojiModel { id: emojiModel } emojiModel: EmojiModel { id: emojiModel }
}
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 1 Layout.preferredHeight: 1
Layout.leftMargin: 12
Layout.rightMargin: 12
visible: emojiPicker.visible || replyItem.visible
color: MSettings.darkTheme ? "#424242" : "#e7ebeb" color: MSettings.darkTheme ? "#424242" : "#e7ebeb"
} }
}
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true

View File

@ -77,6 +77,7 @@ void RoomListModel::connectRoomSignals(SpectralRoom* room) {
connect(room, &Room::aboutToAddNewMessages, this, connect(room, &Room::aboutToAddNewMessages, this,
[=](QMatrixClient::RoomEventsRange eventsRange) { [=](QMatrixClient::RoomEventsRange eventsRange) {
RoomEvent* event = (eventsRange.end() - 1)->get(); RoomEvent* event = (eventsRange.end() - 1)->get();
if (event->isStateEvent()) return;
User* sender = room->user(event->senderId()); User* sender = room->user(event->senderId());
if (sender == room->localUser()) return; if (sender == room->localUser()) return;
QUrl _url = room->avatarUrl(); QUrl _url = room->avatarUrl();