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

Graph QL POC #6024

Merged
merged 25 commits into from Jul 29, 2022
Merged

Graph QL POC #6024

merged 25 commits into from Jul 29, 2022

Conversation

larkox
Copy link
Contributor

@larkox larkox commented Mar 3, 2022

Summary

This is just a draft to show off the progress made. Most of what has been done is just exploratory. It still can use lots of refinement.

Ticket Link

None

Release Note

NONE

@agnivade
Copy link
Member

agnivade commented Apr 7, 2022

@larkox - Is this ready to be reviewed? I'd just like to take a look at the query.

@larkox
Copy link
Contributor Author

larkox commented Apr 7, 2022

@agnivade As POC, it is ready to review (the only "missing part" is the channel stats that were merged not long ago, but there won't be much difference).

My next objective (still not started) is to make this code "production ready", so any feedback on the current state is welcomed.

Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small thing that I spotted.

app/client/graphQL/entry.ts Outdated Show resolved Hide resolved
app/client/graphQL/entry.ts Outdated Show resolved Hide resolved
app/client/graphQL/entry.ts Outdated Show resolved Hide resolved
Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore my previous comments. Queries look good to me. 👍

@@ -324,37 +326,12 @@ export const syncOtherServers = async (serverUrl: string) => {
for (const server of servers) {
if (server.url !== serverUrl && server.lastActiveAt > 0) {
registerDeviceToken(server.url);
syncAllChannelMembers(server.url);
appEntry(server.url, server.lastActiveAt, false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enahum This is the design choice that probably I should revert. My idea here was to reuse all the logic behind the entry to sync the other servers, but I understand we already are going through the App entry when we switch, right?
So... we only need the channel members (no categories, no channels, no nothing) to calculate unreads and mentions. Am I right?

If so, I will revert this change and update the "syncAllChannelMembers" to use graphQL too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we only need channel members and threads to show the mention badges. As we switch servers we go through the appEntry

@larkox larkox marked this pull request as ready for review July 6, 2022 11:46
@larkox larkox added the 2: Dev Review Requires review by a core commiter label Jul 6, 2022
@larkox larkox requested a review from agnivade July 13, 2022 17:19
Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wohoo!

@zefhemel zefhemel removed the request for review from enahum July 13, 2022 18:14
Copy link
Contributor

@enahum enahum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks very good

app/actions/remote/entry/common.ts Outdated Show resolved Hide resolved
app/actions/remote/entry/common.ts Show resolved Hide resolved
app/actions/remote/entry/common.ts Outdated Show resolved Hide resolved
app/actions/remote/entry/common.ts Outdated Show resolved Hide resolved
app/actions/remote/entry/gql_common.ts Outdated Show resolved Hide resolved
app/actions/remote/entry/gql_common.ts Outdated Show resolved Hide resolved
if (prefData.preferences) {
const crtToggled = await getHasCRTChanged(database, prefData.preferences);
if (crtToggled) {
const {error} = await truncateCrtRelatedTables(serverUrl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @koox00

app/client/graphQL/types.ts Outdated Show resolved Hide resolved
Comment on lines 6 to 14
export enum CustomStatusDuration {
DONT_CLEAR = '',
THIRTY_MINUTES = 'thirty_minutes',
ONE_HOUR = 'one_hour',
FOUR_HOURS = 'four_hours',
TODAY = 'today',
THIS_WEEK = 'this_week',
DATE_AND_TIME = 'date_and_time',
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is causing the tests to fail

@@ -40,7 +39,6 @@ export {
Categories,
Channel,
Config,
CustomStatusDuration,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests failing

@@ -8,7 +8,7 @@ import {Text, TouchableOpacity, View} from 'react-native';
import CompassIcon from '@components/compass_icon';
import CustomStatusExpiry from '@components/custom_status/custom_status_expiry';
import FormattedText from '@components/formatted_text';
import {CustomStatusDuration, CST} from '@constants/custom_status';
import {CST} from '@constants/custom_status';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test failing..

Comment on lines 100 to 108
enum CustomStatusDuration {
DONT_CLEAR = '',
THIRTY_MINUTES = 'thirty_minutes',
ONE_HOUR = 'one_hour',
FOUR_HOURS = 'four_hours',
TODAY = 'today',
THIS_WEEK = 'this_week',
DATE_AND_TIME = 'date_and_time',
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll need a const for this as the tests are failing

@larkox larkox requested a review from enahum July 28, 2022 19:46
@enahum
Copy link
Contributor

enahum commented Jul 29, 2022

@avinashlng1080 please review

Copy link
Contributor

@avinashlng1080 avinashlng1080 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just left a few comments that if need be can be tackled in future PRs

if (duration && duration === CustomStatusDuration.DATE_AND_TIME) {
if (duration && duration === 'date_and_time') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not do duration === CustomStatusDurationEnum.DATE_AND_TIME ?

{emoji: 'house', message: t('custom_status.suggestions.working_from_home'), messageDefault: 'Working from home', durationDefault: CustomStatusDuration.TODAY},
{emoji: 'palm_tree', message: t('custom_status.suggestions.on_a_vacation'), messageDefault: 'On a vacation', durationDefault: CustomStatusDuration.THIS_WEEK},
{emoji: 'calendar', message: t('custom_status.suggestions.in_a_meeting'), messageDefault: 'In a meeting', durationDefault: 'one_hour'},
{emoji: 'hamburger', message: t('custom_status.suggestions.out_for_lunch'), messageDefault: 'Out for lunch', durationDefault: 'thirty_minutes'},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have done CustomStatusDurationEnum.THIRTY_MINUTES ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but I feel this is more idiomatic on how TypeScript works. The only one we use the enum in many places is the one that translates to '', since it is not readable enough.


if (chData?.channels?.length && chData.memberships?.length) {
// defer fetching posts for unread channels on initial team
fetchPostsForUnreadChannels(serverUrl, chData.channels, chData.memberships, initialChannelId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Gekidou branch, we had a fix from PR #6453 to delay the fetchPostsForUnreadChannels call. Though it was a fix, we should check if this is happening on the 'GraphQL' flow as well.

@avinashlng1080 avinashlng1080 added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core commiter labels Jul 29, 2022
@larkox larkox merged commit bae5477 into mattermost:gekidou Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants