debian-mirror-gitlab/app/assets/javascripts/diff_notes/mixins/discussion.js

38 lines
828 B
JavaScript
Raw Normal View History

2019-12-04 20:38:33 +05:30
/* eslint-disable guard-for-in, no-restricted-syntax, */
2017-08-17 22:00:37 +05:30
2018-11-08 19:23:39 +05:30
const DiscussionMixins = {
2017-08-17 22:00:37 +05:30
computed: {
2019-12-04 20:38:33 +05:30
discussionCount() {
2017-08-17 22:00:37 +05:30
return Object.keys(this.discussions).length;
},
2019-12-04 20:38:33 +05:30
resolvedDiscussionCount() {
2017-08-17 22:00:37 +05:30
let resolvedCount = 0;
for (const discussionId in this.discussions) {
const discussion = this.discussions[discussionId];
if (discussion.isResolved()) {
resolvedCount += 1;
}
}
return resolvedCount;
},
2019-12-04 20:38:33 +05:30
unresolvedDiscussionCount() {
2017-08-17 22:00:37 +05:30
let unresolvedCount = 0;
for (const discussionId in this.discussions) {
const discussion = this.discussions[discussionId];
if (!discussion.isResolved()) {
unresolvedCount += 1;
}
}
return unresolvedCount;
2018-12-13 13:39:08 +05:30
},
},
2017-08-17 22:00:37 +05:30
};
2018-11-08 19:23:39 +05:30
export default DiscussionMixins;