Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/graphql_shared/issuable_client.js')
-rw-r--r--app/assets/javascripts/graphql_shared/issuable_client.js43
1 files changed, 40 insertions, 3 deletions
diff --git a/app/assets/javascripts/graphql_shared/issuable_client.js b/app/assets/javascripts/graphql_shared/issuable_client.js
index ae7676a3e9e..08733bbe620 100644
--- a/app/assets/javascripts/graphql_shared/issuable_client.js
+++ b/app/assets/javascripts/graphql_shared/issuable_client.js
@@ -2,10 +2,11 @@ import produce from 'immer';
import VueApollo from 'vue-apollo';
import { defaultDataIdFromObject } from '@apollo/client/core';
import { concatPagination } from '@apollo/client/utilities';
+import errorQuery from '~/boards/graphql/client/error.query.graphql';
import getIssueStateQuery from '~/issues/show/queries/get_issue_state.query.graphql';
import createDefaultClient from '~/lib/graphql';
import typeDefs from '~/work_items/graphql/typedefs.graphql';
-import { WIDGET_TYPE_NOTES } from '~/work_items/constants';
+import { WIDGET_TYPE_NOTES, WIDGET_TYPE_AWARD_EMOJI } from '~/work_items/constants';
import activeBoardItemQuery from 'ee_else_ce/boards/graphql/client/active_board_item.query.graphql';
export const config = {
@@ -35,6 +36,15 @@ export const config = {
},
},
},
+ WorkItemWidgetAwardEmoji: {
+ fields: {
+ // If we add any key args, the awardEmoji field becomes awardEmoji({"first":10}) and
+ // kills any possibility to handle it on the widget level without hardcoding a string.
+ awardEmoji: {
+ keyArgs: false,
+ },
+ },
+ },
WorkItemWidgetProgress: {
fields: {
progress: {
@@ -67,10 +77,30 @@ export const config = {
const incomingWidget = incoming.find(
(w) => w.type && w.type === existingWidget.type,
);
- // We don't want to override existing notes with empty widget on work item updates
- if (incomingWidget?.type === WIDGET_TYPE_NOTES && !context.variables.pageSize) {
+ // We don't want to override existing notes or award emojis with empty widget on work item updates
+ if (
+ (incomingWidget?.type === WIDGET_TYPE_NOTES ||
+ incomingWidget?.type === WIDGET_TYPE_AWARD_EMOJI) &&
+ !context.variables.pageSize
+ ) {
return existingWidget;
}
+
+ // we want to concat next page of awardEmoji to the existing ones
+ if (incomingWidget?.type === WIDGET_TYPE_AWARD_EMOJI && context.variables.after) {
+ // concatPagination won't work because we were placing new widget here so we have to do this manually
+ return {
+ ...incomingWidget,
+ awardEmoji: {
+ ...incomingWidget.awardEmoji,
+ nodes: [
+ ...existingWidget.awardEmoji.nodes,
+ ...incomingWidget.awardEmoji.nodes,
+ ],
+ },
+ };
+ }
+
// we want to concat next page of discussions to the existing ones
if (incomingWidget?.type === WIDGET_TYPE_NOTES && context.variables.after) {
// concatPagination won't work because we were placing new widget here so we have to do this manually
@@ -195,6 +225,13 @@ export const resolvers = {
});
return boardItem;
},
+ setError(_, { error }, { cache }) {
+ cache.writeQuery({
+ query: errorQuery,
+ data: { boardsAppError: error },
+ });
+ return error;
+ },
clientToggleListCollapsed(_, { list = {}, collapsed = false }) {
return {
list: {