fix: log pipeline better

pull/2971/head
William Grant 2 years ago
parent 00ef4a47a2
commit ec81805745

@ -1121,9 +1121,6 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
const expireTimer = this.get('expireTimer');
if (canBeDeleteAfterRead && expirationType && expireTimer > 0) {
window.log.debug(
`WIP: markMessageReadNoCommit ${this.idForLogging()} is deleteAfterRead starting expiration`
);
const expirationMode = changeToDisappearingMessageConversationType(
convo,
expirationType,
@ -1131,6 +1128,7 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
);
if (expirationMode === 'legacy' || expirationMode === 'deleteAfterRead') {
window.log.debug(`WIP: markMessageReadNoCommit setExpirationStartTimestamp is starting`);
this.set({
expirationStartTimestamp: setExpirationStartTimestamp(expirationMode, readAt),
});

@ -893,6 +893,8 @@ export async function handleDataExtractionNotification(
? changeToDisappearingMessageType(convo, expireTimer, expirationMode)
: undefined;
// NOTE Trigger for an incoming message
// TODO legacy messages support will be removed in a future release
if (expirationMode === 'legacy' || expirationMode === 'deleteAfterSend') {
expirationStartTimestamp = setExpirationStartTimestamp(expirationMode);
}

@ -180,6 +180,7 @@ function updateReadStatus(message: MessageModel) {
if (message.isExpirationTimerUpdate()) {
message.set({ unread: READ_MESSAGE_STATE.read });
const convo = message.getConversation();
// TODO legacy messages support will be removed in a future release
const canBeDeleteAfterRead = convo && !convo.isMe() && convo.isPrivate();
const expirationType = message.get('expirationType');
const expireTimer = message.get('expireTimer');
@ -192,6 +193,7 @@ function updateReadStatus(message: MessageModel) {
);
if (expirationMode === 'legacy' || expirationMode === 'deleteAfterRead') {
window.log.debug(`WIP: updateReadStatus setExpirationStartTimestamp is starting`);
message.set({
expirationStartTimestamp: setExpirationStartTimestamp(expirationMode),
});
@ -410,12 +412,16 @@ export async function handleMessageJob(
// source === UserUtils.getOurPubKeyStrFromCache() &&
// messageModel.get('type') === 'outgoing';
// TODO legacy messages support will be removed in a future release
const canBeDeleteAfterSend = conversation && conversation.isMe() && conversation.isGroup();
// TODO legacy support could be broken after V2 is released on a modern client on a 1-1 with disapearAfterRead
if (
expirationMode === 'legacy' ||
(canBeDeleteAfterSend && expirationMode === 'legacy') ||
expirationMode === 'deleteAfterSend'
// ||
// legacySyncMessageMustDisappearAfterRead
) {
window.log.debug(`WIP: handleMessageJob setExpirationStartTimestamp is starting`);
messageModel.set({
expirationStartTimestamp: setExpirationStartTimestamp(
expirationMode,

@ -184,6 +184,8 @@ export async function addUpdateMessage(
? changeToDisappearingMessageType(convo, convo.get('expireTimer'), expirationMode)
: undefined;
// NOTE Trigger for an incoming message
// TODO legacy messages support will be removed in a future release
if (expirationMode === 'legacy' || expirationMode === 'deleteAfterSend') {
expirationStartTimestamp = setExpirationStartTimestamp(expirationMode, sentAt);
}

@ -146,8 +146,9 @@ async function handleMessageSentSuccess(
expireTimer
);
// NOTE we treat all outbound disappearing messages as read as soon as they are sent.
// NOTE starting disappearing messages timer for all outbound messages
if (expirationMode !== 'off') {
window.log.debug(`WIP: handleMessageSentSuccess setExpirationStartTimestamp is starting`);
fetchedMessage.set({
expirationStartTimestamp: setExpirationStartTimestamp(
expirationMode,

@ -522,6 +522,7 @@ export async function USER_callRecipient(recipient: string) {
let expirationStartTimestamp;
if (calledConvo && expirationMode && expireTimer > 0) {
// TODO legacy messages support will be removed in a future release
expirationType = changeToDisappearingMessageType(calledConvo, expireTimer, expirationMode);
if (expirationMode === 'legacy' || expirationMode === 'deleteAfterSend') {
@ -902,6 +903,7 @@ export async function USER_acceptIncomingCallRequest(fromSender: string) {
let expirationStartTimestamp;
if (callerConvo && expirationMode && expireTimer > 0) {
// TODO legacy messages support will be removed in a future release
expirationType = changeToDisappearingMessageType(callerConvo, expireTimer, expirationMode);
if (expirationMode === 'legacy' || expirationMode === 'deleteAfterSend') {
@ -1254,6 +1256,7 @@ async function addMissedCallMessage(callerPubkey: string, sentAt: number) {
let expirationStartTimestamp;
if (incomingCallConversation && expirationMode && expireTimer > 0) {
// TODO legacy messages support will be removed in a future release
expirationType = changeToDisappearingMessageType(
incomingCallConversation,
expireTimer,

Loading…
Cancel
Save