diff --git a/src/contacts/ContactHistory.ts b/src/contacts/ContactHistory.ts index ba2176af..126bee42 100644 --- a/src/contacts/ContactHistory.ts +++ b/src/contacts/ContactHistory.ts @@ -305,24 +305,26 @@ export class ContactHistory extends RapidElement { } }); - let fetchedEvents = results.events.reverse(); + const fetchedEvents = results.events.reverse(); // dedupe any events we get from the server // TODO: perhaps make this a little less crazy - fetchedEvents = fetchedEvents.filter(item => { - const found = !!this.eventGroups.find( - g => - !!g.events.find( - exists => - exists.created_on === item.created_on && - exists.type === item.type - ) + let removed = 0; + this.eventGroups.forEach(g => { + const before = g.events.length; + g.events = g.events.filter( + prev => + !fetchedEvents.find(fetched => { + return ( + prev.created_on == fetched.created_on && + prev.type === fetched.type + ); + }) ); - - return !found; + removed += before - g.events.length; }); - this.lastRefreshAdded = fetchedEvents.length; + this.lastRefreshAdded = fetchedEvents.length - removed; // reflow our most recent event group in case it merges with our new groups const previousGroups = [...this.eventGroups]; diff --git a/src/contacts/events.ts b/src/contacts/events.ts index 73bd9180..83a105a9 100644 --- a/src/contacts/events.ts +++ b/src/contacts/events.ts @@ -1,4 +1,4 @@ -import { css, html, TemplateResult } from 'lit'; +import { css, EventPart, html, TemplateResult } from 'lit'; import { Msg, ObjectReference, User } from '../interfaces'; import { getClasses, @@ -212,6 +212,10 @@ export const getEventStyles = () => { background: var(--color-automated) !important; } + .queued { + opacity: 0.3; + } + .optin_requested { --icon-color: var(--color-primary-dark); } @@ -823,6 +827,10 @@ export const renderMsgEvent = ( ); } + if (event.status === 'Q') { + summary.push(html`
Queued
`); + } + summary.push( html`` ); - return html`
+ return html`
${summary}