forked from withspectrum/spectrum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
8,717 additions
and
17,945 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
var apollo = require('apollo-utilities'), | ||
toIdValue = apollo.toIdValue; | ||
|
||
function dataIdFromObject(result) { | ||
if (result.__typename) { | ||
// Custom Community cache key based on slug | ||
if (result.__typename === 'Community' && !!result.slug) { | ||
return result.__typename + ':' + result.slug; | ||
} | ||
// Custom Channel cache key based on slug and community slug | ||
if ( | ||
result.__typename === 'Channel' && | ||
!!result.slug && | ||
!!result.community && | ||
!!result.community.slug | ||
) { | ||
return ( | ||
result.__typename + ':' + result.community.slug + ':' + result.slug | ||
); | ||
} | ||
// This was copied from the default dataIdFromObject | ||
if (result.id !== undefined) { | ||
return result.__typename + ':' + result.id; | ||
} | ||
if (result._id !== undefined) { | ||
return result.__typename + ':' + result._id; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
var getSharedApolloClientOptions = function getSharedApolloClientOptions() { | ||
return { | ||
queryDeduplication: true, | ||
dataIdFromObject: dataIdFromObject, | ||
customResolvers: { | ||
Query: { | ||
thread: function thread(_, _ref) { | ||
var id = _ref.id; | ||
return toIdValue(dataIdFromObject({ __typename: 'Thread', id: id })); | ||
}, | ||
community: function community(_, _ref2) { | ||
var slug = _ref2.slug; | ||
return toIdValue( | ||
dataIdFromObject({ __typename: 'Community', slug: slug }) | ||
); | ||
}, | ||
channel: function channel(_, _ref3) { | ||
var channelSlug = _ref3.channelSlug, | ||
communitySlug = _ref3.communitySlug; | ||
return toIdValue( | ||
dataIdFromObject({ | ||
__typename: 'Channel', | ||
slug: channelSlug, | ||
community: { slug: communitySlug }, | ||
}) | ||
); | ||
}, | ||
}, | ||
}, | ||
}; | ||
}; | ||
|
||
module.exports = getSharedApolloClientOptions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
admin/src/api/fragments/directMessageThread/directMessageThreadInfo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.