Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PREAPPS-3434: Shared Folders | Mark As Read does not display correct Unread items count on Folder #270

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/batch-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,14 +704,20 @@ export class ZimbraBatchClient {
sharedItemId
} = folder;

/** changed the id to zimbraId:sharedItemId, which is required while moving contact to shared folder and
* server also returns this id in notfications. The original id is stored in userId.
/**
* `For Shared folders`,
* there's a difference between the `Folder ID` returned by `GetFolder` API and the `notify` response data returned by server.
* Since GetFolder Query contains fragments data with different folder IDs, when `notifications.ts` writes the `Folder fragment`,
* its actually creating new orphan fragment rather than updating existing one because.
* Due to this, updates (like folder unread items count ) are not synced to UI properly.
*
* To fix this, we make the `Folder ID` returned by `GetFolder` API equal to what we receive via `notification`.
*/

if (folder.view === FolderView.Contact) {
(folder.userId = folder.id),
(folder.id = `${ownerZimbraId}:${sharedItemId}`);
if (ownerZimbraId && sharedItemId) {
folder.originalId = folder.id;
folder.id = `${ownerZimbraId}:${sharedItemId}`;
}

if (oname && folders) {
folder.folders = updateAbsoluteFolderPath(
oname,
Expand Down
2 changes: 1 addition & 1 deletion src/schema/generated-schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ export type Folder = {
url?: Maybe<Scalars['String']>;
local?: Maybe<Scalars['Boolean']>;
droppable?: Maybe<Scalars['Boolean']>;
userId?: Maybe<Scalars['ID']>;
originalId?: Maybe<Scalars['ID']>;
};

export type FolderAppointmentsArgs = {
Expand Down
2 changes: 1 addition & 1 deletion src/schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ type Folder {
url: String
local: Boolean
droppable: Boolean
userId: ID
originalId: ID # To keep ID of Shared folders whose server returned ID would be either numeric OR a combination of ownerZimbraId and sharedItemId.
}

type ACL {
Expand Down