decidim-comments 0.23.0 → 0.24.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/comments/bundle.js.map +1 -1
  3. data/app/assets/javascripts/decidim/comments/comments.component.js.es6 +292 -0
  4. data/app/assets/javascripts/decidim/comments/comments.component.test.js +581 -0
  5. data/app/assets/javascripts/decidim/comments/comments.js.erb +1 -1
  6. data/app/cells/decidim/comments/comment/actions.erb +7 -0
  7. data/app/cells/decidim/comments/comment/alignment_badge.erb +4 -0
  8. data/app/cells/decidim/comments/comment/author.erb +1 -0
  9. data/app/cells/decidim/comments/comment/show.erb +40 -0
  10. data/app/cells/decidim/comments/comment/utilities.erb +13 -0
  11. data/app/cells/decidim/comments/comment/votes.erb +25 -0
  12. data/app/cells/decidim/comments/comment_card_cell.rb +22 -0
  13. data/app/cells/decidim/comments/comment_cell.rb +142 -8
  14. data/app/cells/decidim/comments/comment_form/comment_as.erb +10 -0
  15. data/app/cells/decidim/comments/comment_form/show.erb +24 -0
  16. data/app/cells/decidim/comments/comment_form_cell.rb +94 -0
  17. data/app/cells/decidim/comments/comment_m/top.erb +1 -1
  18. data/app/cells/decidim/comments/comment_thread/show.erb +6 -0
  19. data/app/cells/decidim/comments/comment_thread/title.erb +3 -0
  20. data/app/cells/decidim/comments/comment_thread_cell.rb +30 -0
  21. data/app/cells/decidim/comments/comments/add_comment.erb +30 -0
  22. data/app/cells/decidim/comments/comments/blocked_comments_warning.erb +3 -0
  23. data/app/cells/decidim/comments/comments/order_control.erb +37 -0
  24. data/app/cells/decidim/comments/comments/show.erb +32 -0
  25. data/app/cells/decidim/comments/comments/single_comment_warning.erb +9 -0
  26. data/app/cells/decidim/comments/comments/user_comments_blocked_warning.erb +3 -0
  27. data/app/cells/decidim/comments/comments_cell.rb +134 -0
  28. data/app/commands/decidim/comments/vote_comment.rb +34 -10
  29. data/app/controllers/decidim/comments/application_controller.rb +16 -0
  30. data/app/controllers/decidim/comments/comments_controller.rb +122 -0
  31. data/app/controllers/decidim/comments/votes_controller.rb +41 -0
  32. data/app/events/decidim/comments/comment_created_event.rb +1 -1
  33. data/app/events/decidim/comments/comment_downvoted_event.rb +8 -0
  34. data/app/events/decidim/comments/comment_event.rb +1 -9
  35. data/app/events/decidim/comments/comment_upvoted_event.rb +8 -0
  36. data/app/events/decidim/comments/comment_voted_event.rb +26 -0
  37. data/app/forms/decidim/comments/comment_form.rb +6 -2
  38. data/app/models/decidim/comments/comment.rb +33 -11
  39. data/app/models/decidim/comments/seed.rb +1 -1
  40. data/app/permissions/decidim/comments/permissions.rb +59 -0
  41. data/app/queries/decidim/comments/metrics/comment_participants_metric_measure.rb +2 -2
  42. data/app/queries/decidim/comments/metrics/comments_metric_manage.rb +5 -6
  43. data/app/queries/decidim/comments/sorted_comments.rb +18 -14
  44. data/app/views/decidim/comments/comments/_comment.html.erb +5 -0
  45. data/app/views/decidim/comments/comments/_comments.html.erb +1 -0
  46. data/app/views/decidim/comments/comments/create.js.erb +16 -0
  47. data/app/views/decidim/comments/comments/error.js.erb +1 -0
  48. data/app/views/decidim/comments/comments/index.js.erb +24 -0
  49. data/app/views/decidim/comments/comments/reload.js.erb +21 -0
  50. data/app/views/decidim/comments/votes/create.js.erb +23 -0
  51. data/app/views/decidim/comments/votes/error.js.erb +1 -0
  52. data/config/locales/ar.yml +0 -2
  53. data/config/locales/ca.yml +7 -2
  54. data/config/locales/cs.yml +20 -3
  55. data/config/locales/de.yml +46 -30
  56. data/config/locales/el.yml +0 -2
  57. data/config/locales/en.yml +17 -2
  58. data/config/locales/es-MX.yml +7 -2
  59. data/config/locales/es-PY.yml +7 -2
  60. data/config/locales/es.yml +7 -2
  61. data/config/locales/eu.yml +0 -2
  62. data/config/locales/fi-plain.yml +17 -2
  63. data/config/locales/fi.yml +17 -2
  64. data/config/locales/fr-CA.yml +17 -2
  65. data/config/locales/fr.yml +17 -2
  66. data/config/locales/gl.yml +20 -2
  67. data/config/locales/hu.yml +0 -2
  68. data/config/locales/id-ID.yml +0 -2
  69. data/config/locales/is-IS.yml +0 -1
  70. data/config/locales/it.yml +5 -2
  71. data/config/locales/ja.yml +12 -8
  72. data/config/locales/lv.yml +0 -2
  73. data/config/locales/nl.yml +7 -9
  74. data/config/locales/no.yml +0 -2
  75. data/config/locales/pl.yml +22 -4
  76. data/config/locales/pt-BR.yml +0 -2
  77. data/config/locales/pt.yml +0 -2
  78. data/config/locales/ro-RO.yml +0 -2
  79. data/config/locales/ru.yml +0 -2
  80. data/config/locales/si-LK.yml +1 -0
  81. data/config/locales/sk.yml +0 -2
  82. data/config/locales/sv.yml +7 -2
  83. data/config/locales/sw-KE.yml +1 -0
  84. data/config/locales/tr-TR.yml +60 -35
  85. data/config/locales/uk.yml +0 -1
  86. data/config/locales/zh-CN.yml +0 -2
  87. data/lib/decidim/api/add_comment_type.rb +13 -0
  88. data/lib/decidim/api/comment_mutation_type.rb +22 -0
  89. data/lib/decidim/api/comment_type.rb +89 -0
  90. data/lib/decidim/api/commentable_interface.rb +50 -0
  91. data/lib/decidim/api/commentable_mutation_type.rb +30 -0
  92. data/{app/types/decidim/comments → lib/decidim/api}/commentable_type.rb +2 -5
  93. data/lib/decidim/comments.rb +1 -3
  94. data/lib/decidim/comments/api.rb +12 -0
  95. data/lib/decidim/comments/comments_helper.rb +10 -52
  96. data/lib/decidim/comments/engine.rb +9 -7
  97. data/lib/decidim/comments/mutation_extensions.rb +22 -22
  98. data/lib/decidim/comments/query_extensions.rb +12 -14
  99. data/lib/decidim/comments/test.rb +1 -0
  100. data/lib/decidim/comments/test/shared_examples/comment_voted_event.rb +65 -0
  101. data/lib/decidim/comments/version.rb +1 -1
  102. metadata +72 -69
  103. data/app/assets/javascripts/decidim/comments/bundle.js +0 -268
  104. data/app/frontend/application/apollo_client.ts +0 -12
  105. data/app/frontend/application/application.component.test.tsx +0 -23
  106. data/app/frontend/application/application.component.tsx +0 -35
  107. data/app/frontend/application/icon.component.test.tsx +0 -38
  108. data/app/frontend/application/icon.component.tsx +0 -46
  109. data/app/frontend/comments/add_comment_form.component.test.tsx +0 -265
  110. data/app/frontend/comments/add_comment_form.component.tsx +0 -482
  111. data/app/frontend/comments/comment.component.test.tsx +0 -490
  112. data/app/frontend/comments/comment.component.tsx +0 -677
  113. data/app/frontend/comments/comment_order_selector.component.test.tsx +0 -29
  114. data/app/frontend/comments/comment_order_selector.component.tsx +0 -106
  115. data/app/frontend/comments/comment_thread.component.test.tsx +0 -82
  116. data/app/frontend/comments/comment_thread.component.tsx +0 -81
  117. data/app/frontend/comments/comments.component.test.tsx +0 -150
  118. data/app/frontend/comments/comments.component.tsx +0 -289
  119. data/app/frontend/comments/down_vote_button.component.test.tsx +0 -59
  120. data/app/frontend/comments/down_vote_button.component.tsx +0 -133
  121. data/app/frontend/comments/up_vote_button.component.test.tsx +0 -59
  122. data/app/frontend/comments/up_vote_button.component.tsx +0 -133
  123. data/app/frontend/comments/vote_button.component.tsx +0 -50
  124. data/app/frontend/comments/vote_button_component.test.tsx +0 -64
  125. data/app/frontend/entry.ts +0 -38
  126. data/app/frontend/entry_test.ts +0 -6
  127. data/app/frontend/fragments/add_comment_form_commentable.fragment.graphql +0 -4
  128. data/app/frontend/fragments/add_comment_form_session.fragment.graphql +0 -6
  129. data/app/frontend/fragments/comment.fragment.graphql +0 -14
  130. data/app/frontend/fragments/comment_data.fragment.graphql +0 -27
  131. data/app/frontend/fragments/comment_thread.fragment.graphql +0 -6
  132. data/app/frontend/fragments/down_vote_button.fragment.graphql +0 -6
  133. data/app/frontend/fragments/up_vote_button.fragment.graphql +0 -6
  134. data/app/frontend/mutations/add_comment.mutation.graphql +0 -9
  135. data/app/frontend/mutations/down_vote.mutation.graphql +0 -9
  136. data/app/frontend/mutations/up_vote.mutation.graphql +0 -9
  137. data/app/frontend/queries/comments.query.graphql +0 -26
  138. data/app/frontend/support/asset_url.ts +0 -11
  139. data/app/frontend/support/generate_comments_data.ts +0 -49
  140. data/app/frontend/support/generate_user_data.ts +0 -14
  141. data/app/frontend/support/generate_user_group_data.ts +0 -14
  142. data/app/frontend/support/graphql_transformer.js +0 -32
  143. data/app/frontend/support/load_translations.ts +0 -48
  144. data/app/frontend/support/require_all.ts +0 -10
  145. data/app/frontend/support/resolve_graphql_query.ts +0 -37
  146. data/app/frontend/support/schema.ts +0 -2026
  147. data/app/types/decidim/comments/commentable_interface.rb +0 -61
  148. data/app/types/decidim/comments/commentable_mutation_type.rb +0 -33
  149. data/lib/decidim/comments/api/add_comment_type.rb +0 -13
  150. data/lib/decidim/comments/api/comment_mutation_type.rb +0 -20
  151. data/lib/decidim/comments/api/comment_type.rb +0 -89
@@ -1,59 +0,0 @@
1
- import { shallow } from "enzyme";
2
- import * as React from "react";
3
-
4
- import { UpVoteButton } from "./up_vote_button.component";
5
- import VoteButton from "./vote_button.component";
6
-
7
- import generateCommentsData from "../support/generate_comments_data";
8
- import generateUserData from "../support/generate_user_data";
9
-
10
- import { UpVoteButtonFragment } from "../support/schema";
11
-
12
- describe("<UpVoteButton />", () => {
13
- const orderBy = "older";
14
- const rootCommentable = {
15
- id: "1",
16
- type: "Decidim::DummyResources::DummyResource"
17
- };
18
- let comment: UpVoteButtonFragment;
19
- let session: any = null;
20
- const upVote = jasmine.createSpy("upVote");
21
-
22
- beforeEach(() => {
23
- const commentsData = generateCommentsData(1);
24
- session = {
25
- user: generateUserData()
26
- };
27
- comment = commentsData[0];
28
- });
29
-
30
- it("should render a VoteButton component with the correct props", () => {
31
- const wrapper = shallow(<UpVoteButton session={session} comment={comment} upVote={upVote} rootCommentable={rootCommentable} orderBy={orderBy} />);
32
- expect(wrapper.find(VoteButton).prop("buttonClassName")).toEqual("comment__votes--up");
33
- expect(wrapper.find(VoteButton).prop("iconName")).toEqual("icon-chevron-top");
34
- expect(wrapper.find(VoteButton).prop("votes")).toEqual(comment.upVotes);
35
- });
36
-
37
- it("should pass disabled prop as false if comment upVoted is true", () => {
38
- comment.upVoted = true;
39
- const wrapper = shallow(<UpVoteButton session={session} comment={comment} upVote={upVote} rootCommentable={rootCommentable} orderBy={orderBy} />);
40
- expect(wrapper.find(VoteButton).prop("disabled")).toBeFalsy();
41
- });
42
-
43
- it("should pass disabled prop as false if comment downVoted is true", () => {
44
- comment.downVoted = true;
45
- const wrapper = shallow(<UpVoteButton session={session} comment={comment} upVote={upVote} rootCommentable={rootCommentable} orderBy={orderBy} />);
46
- expect(wrapper.find(VoteButton).prop("disabled")).toBeFalsy();
47
- });
48
-
49
- describe("when session is not present", () => {
50
- beforeEach(() => {
51
- session = null;
52
- });
53
-
54
- it("should pass userLoggedIn as false", () => {
55
- const wrapper = shallow(<UpVoteButton session={session} comment={comment} upVote={upVote} rootCommentable={rootCommentable} orderBy={orderBy} />);
56
- expect(wrapper.find(VoteButton).prop("userLoggedIn")).toBeFalsy();
57
- });
58
- });
59
- });
@@ -1,133 +0,0 @@
1
- import * as React from "react";
2
- import { graphql, MutationFunc } from "react-apollo";
3
-
4
- const PropTypes = require("prop-types");
5
-
6
- import VoteButton from "./vote_button.component";
7
-
8
- const { I18n } = require("react-i18nify");
9
-
10
- import {
11
- AddCommentFormCommentableFragment,
12
- AddCommentFormSessionFragment,
13
- CommentFragment,
14
- GetCommentsQuery,
15
- UpVoteButtonFragment,
16
- UpVoteMutation
17
- } from "../support/schema";
18
-
19
- interface UpVoteButtonProps {
20
- session: AddCommentFormSessionFragment & {
21
- user: any;
22
- } | null;
23
- comment: UpVoteButtonFragment;
24
- upVote?: (context: any) => void;
25
- rootCommentable: AddCommentFormCommentableFragment;
26
- orderBy: string;
27
- }
28
-
29
- export const UpVoteButton: React.SFC<UpVoteButtonProps> = (
30
- {
31
- session,
32
- comment: { upVotes, upVoted, downVoted },
33
- upVote
34
- },
35
- context) => {
36
- let selectedClass = "";
37
-
38
- if (upVoted) {
39
- selectedClass = "is-vote-selected";
40
- } else if (downVoted) {
41
- selectedClass = "is-vote-notselected";
42
- }
43
-
44
- const userLoggedIn = session && session.user;
45
- const disabled = false;
46
- const voteAction = () => upVote && upVote(context);
47
-
48
- return (
49
- <VoteButton
50
- buttonClassName="comment__votes--up"
51
- iconName="icon-chevron-top"
52
- text={I18n.t("components.up_vote_button.text")}
53
- votes={upVotes}
54
- voteAction={voteAction}
55
- disabled={disabled}
56
- selectedClass={selectedClass}
57
- userLoggedIn={userLoggedIn}
58
- />
59
- );
60
- };
61
-
62
- UpVoteButton.contextTypes = {
63
- locale: PropTypes.string,
64
- toggleTranslations: PropTypes.bool
65
- };
66
-
67
- const upVoteMutation = require("../mutations/up_vote.mutation.graphql");
68
- const getCommentsQuery = require("../queries/comments.query.graphql");
69
-
70
- const UpVoteButtonWithMutation = graphql<UpVoteMutation, UpVoteButtonProps>(upVoteMutation, {
71
- props: ({ ownProps, mutate }: { ownProps: UpVoteButtonProps, mutate: MutationFunc<UpVoteMutation> }) => ({
72
- upVote: ({ locale, toggleTranslations }: any) => mutate({
73
- variables: {
74
- locale,
75
- toggleTranslations,
76
- id: ownProps.comment.id
77
- },
78
- optimisticResponse: {
79
- __typename: "Mutation",
80
- comment: {
81
- __typename: "CommentMutation",
82
- upVote: {
83
- __typename: "Comment",
84
- ...ownProps.comment,
85
- upVotes: ownProps.comment.upVotes + (ownProps.comment.upVoted ? -1 : 1),
86
- upVoted: true
87
- }
88
- }
89
- },
90
- update: (store, { data }: { data: UpVoteMutation }) => {
91
- const variables = {
92
- locale,
93
- toggleTranslations,
94
- commentableId: ownProps.rootCommentable.id,
95
- commentableType: ownProps.rootCommentable.type,
96
- orderBy: ownProps.orderBy,
97
- singleCommentId: null
98
- };
99
-
100
- const commentReducer = (comment: CommentFragment): CommentFragment => {
101
- const replies = comment.comments || [];
102
-
103
- if (comment.id === ownProps.comment.id && data.comment) {
104
- return data.comment.upVote;
105
- }
106
-
107
- return {
108
- ...comment,
109
- comments: replies.map(commentReducer)
110
- };
111
- };
112
-
113
- const prev = store.readQuery<GetCommentsQuery>({ query: getCommentsQuery, variables });
114
-
115
- if (prev) {
116
- store.writeQuery({
117
- query: getCommentsQuery,
118
- data: {
119
- ...prev,
120
- commentable: {
121
- ...prev.commentable,
122
- comments: prev.commentable.comments.map(commentReducer)
123
- }
124
- },
125
- variables
126
- });
127
- }
128
- }
129
- })
130
- })
131
- })(UpVoteButton);
132
-
133
- export default UpVoteButtonWithMutation;
@@ -1,50 +0,0 @@
1
- import * as React from "react";
2
- import Icon from "../application/icon.component";
3
-
4
- interface VoteButtonProps {
5
- buttonClassName: string;
6
- iconName: string;
7
- text: string;
8
- votes: number;
9
- voteAction?: () => void;
10
- disabled?: boolean;
11
- selectedClass?: string;
12
- userLoggedIn: boolean;
13
- }
14
-
15
- const preventDefault = (event: any) => {
16
- event.preventDefault();
17
- };
18
-
19
- const VoteButton: React.SFC<VoteButtonProps> = ({
20
- buttonClassName,
21
- iconName,
22
- text,
23
- votes,
24
- voteAction,
25
- disabled,
26
- selectedClass,
27
- userLoggedIn
28
- }) => (
29
- <button
30
- className={`${buttonClassName} ${selectedClass}`}
31
- onClick={userLoggedIn ? voteAction : preventDefault}
32
- disabled={disabled}
33
- title={text}
34
- data-open={userLoggedIn ? null : "loginModal"}
35
- >
36
- <span className="show-for-sr">{text}</span>
37
- <Icon name={iconName} iconExtraClassName="icon--small" />
38
- {` ${votes}`}
39
- </button>
40
- );
41
-
42
- VoteButton.defaultProps = {
43
- buttonClassName: "",
44
- iconName: "",
45
- votes: 0,
46
- selectedClass: "selected",
47
- disabled: false
48
- };
49
-
50
- export default VoteButton;
@@ -1,64 +0,0 @@
1
- import { shallow } from "enzyme";
2
- import * as React from "react";
3
- import Icon from "../application/icon.component";
4
- import VoteButton from "./vote_button.component";
5
-
6
- describe("<VoteButton />", () => {
7
- const voteAction: jasmine.Spy = jasmine.createSpy("voteAction");
8
- const preventDefault: jasmine.Spy = jasmine.createSpy("preventDefault");
9
-
10
- beforeEach(() => {
11
- voteAction.calls.reset();
12
- preventDefault.calls.reset();
13
- });
14
-
15
- it("should render the number of votes passed as a prop", () => {
16
- const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" text="Test" voteAction={voteAction} userLoggedIn={true} />);
17
- expect(wrapper.find("button").text()).toMatch(/10/);
18
- });
19
-
20
- it("should render a button with the given buttonClassName", () => {
21
- const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" text="Test" voteAction={voteAction} userLoggedIn={true} />);
22
- expect(wrapper.find("button.vote-button").exists()).toBeTruthy();
23
- });
24
-
25
- it("should render a Icon component with the correct name prop", () => {
26
- const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" text="Test" voteAction={voteAction} userLoggedIn={true} />);
27
- expect(wrapper.find(Icon).prop("name")).toEqual("vote-icon");
28
- });
29
-
30
- it("should render a button with the text as title attribute and screen reader visible element", () => {
31
- const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" text="Test" voteAction={voteAction} userLoggedIn={true} />);
32
- expect(wrapper.find("button").prop("title")).toBe("Test");
33
- expect(wrapper.find("button span.show-for-sr").text()).toEqual("Test");
34
- });
35
-
36
- it("should call the voteAction prop on click", () => {
37
- const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" text="Test" voteAction={voteAction} userLoggedIn={true} />);
38
- wrapper.find("button").simulate("click");
39
- expect(voteAction).toHaveBeenCalled();
40
- });
41
-
42
- it("should disable the button based on the disabled prop", () => {
43
- const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" text="Test" voteAction={voteAction} disabled={true} userLoggedIn={true} />);
44
- expect(wrapper.find("button").props()).toHaveProperty("disabled");
45
- });
46
-
47
- it("should render a button with the given selectedClass", () => {
48
- const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" text="Test" voteAction={voteAction} disabled={true} selectedClass="is-vote-selected" userLoggedIn={true} />);
49
- expect(wrapper.find(".is-vote-selected").exists()).toBeTruthy();
50
- });
51
-
52
- describe("when userLoggedIn prop is false", () => {
53
- it("should add data-open prop as 'loginModal' to the button", () => {
54
- const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" text="Test" voteAction={voteAction} userLoggedIn={false} />);
55
- expect(wrapper.find("button").prop("data-open")).toBe("loginModal");
56
- });
57
-
58
- it("should call the event preventDefault method", () => {
59
- const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" text="Test" voteAction={voteAction} userLoggedIn={false} />);
60
- wrapper.find("button").simulate("click", { preventDefault });
61
- expect(preventDefault).toHaveBeenCalled();
62
- });
63
- });
64
- });
@@ -1,38 +0,0 @@
1
- import * as React from "react";
2
- import * as ReactDOM from "react-dom";
3
-
4
- import Comments, { CommentsApplicationProps } from "./comments/comments.component";
5
- import loadTranslations from "./support/load_translations";
6
-
7
- window.DecidimComments = window.DecidimComments || {};
8
-
9
- interface StorageDict {
10
- [key: string]: string;
11
- }
12
-
13
- window.DecidimComments.renderCommentsComponent = (nodeId: string, props: CommentsApplicationProps) => {
14
- const node = window.$(`#${nodeId}`)[0];
15
- const queryDict: StorageDict = {};
16
- window
17
- .location
18
- .search
19
- .substr(1)
20
- .split("&")
21
- .forEach(item => queryDict[item.split("=")[0]] = item.split("=")[1]);
22
-
23
- props = { ...props, singleCommentId: queryDict.commentId };
24
-
25
- ReactDOM.render(
26
- React.createElement(Comments, props),
27
- node
28
- );
29
-
30
- if (queryDict.commentId) {
31
- $([document.documentElement, document.body]).animate({
32
- scrollTop: $("#comments").offset()!.top
33
- }, 2000);
34
- }
35
- };
36
-
37
- // Load component locales from yaml files
38
- loadTranslations();
@@ -1,6 +0,0 @@
1
- import { configure } from "enzyme";
2
- import * as Adapter from "enzyme-adapter-react-16";
3
-
4
- import "jest-localstorage-mock";
5
-
6
- configure({ adapter: new Adapter() });
@@ -1,4 +0,0 @@
1
- fragment AddCommentFormCommentable on Commentable {
2
- id
3
- type
4
- }
@@ -1,6 +0,0 @@
1
- fragment AddCommentFormSession on Session {
2
- verifiedUserGroups {
3
- id
4
- name
5
- }
6
- }
@@ -1,14 +0,0 @@
1
- #import "../fragments/comment_data.fragment.graphql"
2
-
3
- fragment Comment on Comment {
4
- ...CommentData
5
- comments {
6
- ...CommentData
7
- comments {
8
- ...CommentData
9
- comments {
10
- ...CommentData
11
- }
12
- }
13
- }
14
- }
@@ -1,27 +0,0 @@
1
- #import "../fragments/up_vote_button.fragment.graphql"
2
- #import "../fragments/down_vote_button.fragment.graphql"
3
-
4
- fragment CommentData on Comment {
5
- id
6
- sgid
7
- type
8
- body
9
- formattedBody
10
- createdAt
11
- formattedCreatedAt
12
- author {
13
- name
14
- nickname
15
- avatarUrl
16
- profilePath
17
- deleted
18
- badge
19
- }
20
- hasComments
21
- acceptsNewComments
22
- userAllowedToComment
23
- alignment
24
- alreadyReported
25
- ...UpVoteButton
26
- ...DownVoteButton
27
- }
@@ -1,6 +0,0 @@
1
- #import "../fragments/comment.fragment.graphql"
2
-
3
- fragment CommentThread on Comment {
4
- hasComments
5
- ...Comment
6
- }
@@ -1,6 +0,0 @@
1
- fragment DownVoteButton on Comment {
2
- id
3
- downVotes
4
- downVoted
5
- upVoted
6
- }
@@ -1,6 +0,0 @@
1
- fragment UpVoteButton on Comment {
2
- id
3
- upVotes
4
- upVoted
5
- downVoted
6
- }
@@ -1,9 +0,0 @@
1
- #import "../fragments/comment_thread.fragment.graphql"
2
-
3
- mutation addComment($commentableId: String!, $commentableType: String!, $body: String!, $alignment: Int, $userGroupId: ID, $locale: String!, $toggleTranslations: Boolean!) {
4
- commentable(id: $commentableId, type: $commentableType, locale: $locale, toggleTranslations: $toggleTranslations) {
5
- addComment(body: $body, alignment: $alignment, userGroupId: $userGroupId) {
6
- ...CommentThread
7
- }
8
- }
9
- }