diff options
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/handlebars/ifSCMChanged2.js')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/handlebars/ifSCMChanged2.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/helpers/handlebars/ifSCMChanged2.js b/server/sonar-web/src/main/js/helpers/handlebars/ifSCMChanged2.js new file mode 100644 index 00000000000..e13fb095c96 --- /dev/null +++ b/server/sonar-web/src/main/js/helpers/handlebars/ifSCMChanged2.js @@ -0,0 +1,11 @@ +import _ from 'underscore'; + +module.exports = function (source, line, options) { + var currentLine = _.findWhere(source, { line: line }), + prevLine = _.findWhere(source, { line: line - 1 }), + changed = true; + if (currentLine && prevLine && currentLine.scmAuthor && prevLine.scmAuthor) { + changed = (currentLine.scmAuthor !== prevLine.scmAuthor) || (currentLine.scmDate !== prevLine.scmDate); + } + return changed ? options.fn(this) : options.inverse(this); +}; |