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');
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 "CASE_UPDATE":
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');
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 "DELETE":
receiverOptions.unshift({id: 'FOLLOW_PEOPLE', name: this.$t('api_test.automation.follow_people')});

View File

@ -291,20 +291,32 @@ export default {
},
handleTestPlanReceivers(row) {
let testPlanReceivers = JSON.parse(JSON.stringify(this.testPlanReceiverOptions));
let i = row.userIds.indexOf('FOLLOW_PEOPLE');
let i2 = row.userIds.indexOf('CREATOR');
switch (row.event) {
case "CREATE":
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;
case "UPDATE":
case "DELETE":
case "COMMENT":
case "COMPLETE":
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 (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
}
break;
default:

View File

@ -284,32 +284,56 @@ export default {
switch (row.event) {
case "CREATE":
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;
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')});
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
}
break;
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')});
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
}
break;
case "COMMENT":
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;
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')});
if (row.isSet) {
if (i2 < 0) {
row.userIds.unshift('CREATOR');
}
if (i < 0) {
row.userIds.unshift('FOLLOW_PEOPLE');
}
}
break;
default: