sphinx-kotlin icon indicating copy to clipboard operation
sphinx-kotlin copied to clipboard

Dashboard not updating with newly added contact

Open 05nelsonm opened this issue 3 years ago • 4 comments

After adding a new contact the Dashboard is not updating with an uninitialized chat for them.

05nelsonm avatar May 15 '21 19:05 05nelsonm

After adding a new contact the Dashboard is not updating with an uninitialized chat for them.

On iOS when adding a new contact, that contact should show at the top of the list, but it currently doesn't. It seems related to the sort function on the dashboard doesn't take into account that adding the contact should trigger the update time =now to put it at the top. Just to make sure we don't copy this existing error over to this version.

pitoi avatar May 15 '21 20:05 pitoi

Yeah, the dashboard sorting is done the same way as iOS; by the time of the last message received for that chat and in the case of a new contact (there is no message yet) it falls back to the time that contact was created at.

If the contact is not a "new" contact, but one that was deleted and then re-added, Relay doesn't actually delete the contact and just marks it as deleted. When it's re-added client side the original created_at time is sent. If all of your other chats have messages that have a received time after the re-added contact's created_at field, then it will be shown last on the list.

@tomastiminskas, when inserting a "new" contact into the DB, should we be overriding the ContactDto.created_at field and inserting the current UTC time?

05nelsonm avatar May 15 '21 21:05 05nelsonm

Actually when deleted all fields are reset and if added again a new record will be created! But what you described happens when the contact stays after being deleted as a from_group contact (because is admin of a tribe you are in or member of one of your tribes). In that case it won’t show on app and if re added then it will become from_group=false and may appear not at the top of the list. We should definitely update the created_at date on relay on that case, actually I talked to Evan about that in the past, but he never applied it since it wasn’t a priority

On Sat, 15 May 2021 at 18:07 Matthew Nelson @.***> wrote:

Yeah, the dashboard sorting is done the same way as iOS; by the time of the last message received for that chat and in the case of a new contact (there is no message yet) it falls back to the time that contact was created at.

If the contact is not a "new" contact, but one that was deleted and then re-added, Relay doesn't actually delete the contact and just marks it as deleted. When it's re-added client side the original created_at time is sent. If all of your other chats have messages that have a received time after the re-added contact's created_at field, then it will be shown last on the list.

@tomastiminskas https://github.com/tomastiminskas, when inserting a "new" contact into the DB, should we be overriding the ContactDto.created_at field and inserting the current UTC time?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stakwork/sphinx-kotlin/issues/108#issuecomment-841725330, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARDN2L4MSY2USE5GXH7Y2TTN3PA3ANCNFSM446FIAPA .

-- Tomás A. Timinskas < Software Engineer >

Skype: tomasatiminskas Mobile: 54 9 11 2450 4411 e-mail: @.***

tomastiminskas avatar May 15 '21 21:05 tomastiminskas

ah ok. We could just use an inserted_at field in the Contact Table. The upsertContact query will not modify that field when updated, only on insertion. We could then use that inserted_at field to sort by as a fallback to having no message.

05nelsonm avatar May 15 '21 21:05 05nelsonm