show message already as black when sent but no remote echo yet

This commit is contained in:
Bruno Windels 2021-02-26 10:40:08 +01:00
parent 5b14d14286
commit 856001160b
4 changed files with 8 additions and 3 deletions

View file

@ -16,6 +16,7 @@ limitations under the License.
import {UpdateAction} from "../UpdateAction.js"; import {UpdateAction} from "../UpdateAction.js";
import {ViewModel} from "../../../../ViewModel.js"; import {ViewModel} from "../../../../ViewModel.js";
import {SendStatus} from "../../../../../matrix/room/sending/PendingEvent.js";
export class SimpleTile extends ViewModel { export class SimpleTile extends ViewModel {
constructor(options) { constructor(options) {
@ -47,6 +48,10 @@ export class SimpleTile extends ViewModel {
return this._entry.isPending; return this._entry.isPending;
} }
get isUnsent() {
return this._entry.isPending && this._entry.status !== SendStatus.Sent;
}
abortSending() { abortSending() {
this._entry.pendingEvent?.abort(); this._entry.pendingEvent?.abort();
} }

View file

@ -159,7 +159,7 @@ a {
margin-left: auto; margin-left: auto;
} }
.TextMessageView.pending .message-container { .TextMessageView.unsent .message-container {
background-color: #333; background-color: #333;
} }

View file

@ -624,7 +624,7 @@ only loads when the top comes into view*/
align-self: start; align-self: start;
} }
.TextMessageView.pending .message-container { .TextMessageView.unsent .message-container {
color: #ccc; color: #ccc;
} }

View file

@ -21,7 +21,7 @@ export function renderMessage(t, vm, children) {
const classes = { const classes = {
"TextMessageView": true, "TextMessageView": true,
own: vm.isOwn, own: vm.isOwn,
pending: vm.isPending, unsent: vm.isUnsent,
unverified: vm.isUnverified, unverified: vm.isUnverified,
continuation: vm => vm.isContinuation, continuation: vm => vm.isContinuation,
messageStatus: vm => vm.shape === "message-status" || vm.shape === "missing-attachment" || vm.shape === "file", messageStatus: vm => vm.shape === "message-status" || vm.shape === "missing-attachment" || vm.shape === "file",