mirror of
https://github.com/wassname/talk.git
synced 2026-08-12 12:30:39 +08:00
Adds privacy type to the methods to add tags.
This commit is contained in:
@@ -16,8 +16,8 @@ describe('graph.mutations.addCommentTag', () => {
|
||||
});
|
||||
|
||||
const query = `
|
||||
mutation AddCommentTag ($id: ID!, $tag: String!) {
|
||||
addCommentTag(id:$id, tag:$tag) {
|
||||
mutation AddCommentTag ($id: ID!, $tag: String!, $privacy_type: String!) {
|
||||
addCommentTag(id:$id, tag:$tag, privacy_type:$privacy_type) {
|
||||
comment {
|
||||
id
|
||||
}
|
||||
@@ -31,7 +31,7 @@ describe('graph.mutations.addCommentTag', () => {
|
||||
it('moderators can add tags to comments', async () => {
|
||||
const user = new UserModel({roles: ['MODERATOR' ]});
|
||||
const context = new Context({user});
|
||||
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST'});
|
||||
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST', privacy_type: 'PUBLIC'});
|
||||
if (response.errors && response.errors.length) {
|
||||
console.error(response.errors);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ describe('graph.mutations.addCommentTag', () => {
|
||||
}).forEach(([ userDescription, user ]) => {
|
||||
it(userDescription, async function () {
|
||||
const context = new Context({user});
|
||||
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST'});
|
||||
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST', privacy_type: 'PUBLIC'});
|
||||
if (response.errors && response.errors.length) {
|
||||
console.error(response.errors);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ describe('graph.mutations.removeCommentTag', () => {
|
||||
const context = new Context({user});
|
||||
|
||||
// add a tag first
|
||||
await CommentsService.addTag(comment.id, 'BEST');
|
||||
await CommentsService.addTag(comment.id, 'BEST', user.id, 'PUBLIC');
|
||||
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST'});
|
||||
if (response.errors && response.errors.length) {
|
||||
console.error(response.errors);
|
||||
@@ -59,7 +59,7 @@ describe('graph.mutations.removeCommentTag', () => {
|
||||
const context = new Context({user});
|
||||
|
||||
// add a tag first
|
||||
await CommentsService.addTag(comment.id, 'BEST');
|
||||
await CommentsService.addTag(comment.id, 'BEST', user ? user.id : null, 'PUBLIC');
|
||||
const response = await graphql(schema, query, {}, context, {id: comment.id, tag: 'BEST'});
|
||||
if (response.errors && response.errors.length) {
|
||||
console.error(response.errors);
|
||||
|
||||
Reference in New Issue
Block a user