refactor: 通知配置加上关注人

This commit is contained in:
CaptainB 2021-10-25 11:50:56 +08:00 committed by 刘瑞斌
parent eca3180c55
commit d4abc0fdc3
4 changed files with 52 additions and 0 deletions

View File

@ -383,6 +383,14 @@ export default {
let i2 = row.userIds.indexOf('CREATOR'); let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) { switch (row.event) {
case "CREATE":
if (i2 > -1) {
row.userIds.splice(i2, 1);
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break;
case "UPDATE": case "UPDATE":
case "CASE_UPDATE": case "CASE_UPDATE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')}); receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});

View File

@ -327,6 +327,14 @@ export default {
let i2 = row.userIds.indexOf('CREATOR'); let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) { switch (row.event) {
case "CREATE":
if (i2 > -1) {
row.userIds.splice(i2, 1);
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break;
case "UPDATE": case "UPDATE":
case "DELETE": case "DELETE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')}); receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});

View File

@ -291,20 +291,32 @@ export default {
}, },
handleTestPlanReceivers(row) { handleTestPlanReceivers(row) {
let testPlanReceivers = JSON.parse(JSON.stringify(this.testPlanReceiverOptions)); let testPlanReceivers = JSON.parse(JSON.stringify(this.testPlanReceiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR'); let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) { switch (row.event) {
case "CREATE": case "CREATE":
testPlanReceivers.unshift({id: 'EXECUTOR', name: this.$t('test_track.plan_view.executor')}); testPlanReceivers.unshift({id: 'EXECUTOR', name: this.$t('test_track.plan_view.executor')});
if (i2 > -1) {
row.userIds.splice(i2, 1);
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break; break;
case "UPDATE": case "UPDATE":
case "DELETE": case "DELETE":
case "COMMENT": case "COMMENT":
case "COMPLETE": case "COMPLETE":
testPlanReceivers.unshift({id: 'CREATOR', name: this.$t('commons.create_user')}); testPlanReceivers.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
testPlanReceivers.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
if (row.isSet) { if (row.isSet) {
if (i2 < 0) { if (i2 < 0) {
row.userIds.unshift('CREATOR'); row.userIds.unshift('CREATOR');
} }
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
} }
break; break;
default: default:

View File

@ -284,32 +284,56 @@ export default {
switch (row.event) { switch (row.event) {
case "CREATE": case "CREATE":
reviewReceiverOptions.unshift({id: 'EXECUTOR', name: this.$t('test_track.review.reviewer')}); reviewReceiverOptions.unshift({id: 'EXECUTOR', name: this.$t('test_track.review.reviewer')});
if (i2 > -1) {
row.userIds.splice(i2, 1);
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break; break;
case "UPDATE": case "UPDATE":
reviewReceiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
reviewReceiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')}); reviewReceiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.isSet) { if (row.isSet) {
if (i2 < 0) { if (i2 < 0) {
row.userIds.unshift('CREATOR'); row.userIds.unshift('CREATOR');
} }
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
} }
break; break;
case "DELETE": case "DELETE":
reviewReceiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
reviewReceiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')}); reviewReceiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.isSet) { if (row.isSet) {
if (i2 < 0) { if (i2 < 0) {
row.userIds.unshift('CREATOR'); row.userIds.unshift('CREATOR');
} }
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
} }
break; break;
case "COMMENT": case "COMMENT":
reviewReceiverOptions.unshift({id: 'MAINTAINER', name: this.$t('test_track.case.maintainer')}); reviewReceiverOptions.unshift({id: 'MAINTAINER', name: this.$t('test_track.case.maintainer')});
if (i2 > -1) {
row.userIds.splice(i2, 1);
}
if (i > -1) {
row.userIds.splice(i, 1);
}
break; break;
case "COMPLETE": case "COMPLETE":
reviewReceiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});
reviewReceiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')}); reviewReceiverOptions.unshift({id: 'CREATOR', name: this.$t('commons.create_user')});
if (row.isSet) { if (row.isSet) {
if (i2 < 0) { if (i2 < 0) {
row.userIds.unshift('CREATOR'); row.userIds.unshift('CREATOR');
} }
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
} }
break; break;
default: default: