[Libreoffice-commits] online.git: loleaflet/src

Andras Timar andras.timar at collabora.com
Mon Oct 31 16:24:49 UTC 2016


 loleaflet/src/core/Socket.js |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

New commits:
commit cbff58346284a0dfd1e231f75396b016fd5b222e
Author: Andras Timar <andras.timar at collabora.com>
Date:   Mon Oct 31 17:24:12 2016 +0100

    loleaflet: add link to git hash

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 6182142..afc04f0 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -140,8 +140,14 @@ L.Socket = L.Class.extend({
 		if (textMsg.startsWith('loolserver ')) {
 			// This must be the first message, unless we reconnect.
 			var loolwsdVersionObj = JSON.parse(textMsg.substring(textMsg.indexOf('{')));
-			$('#loolwsd-version').text(loolwsdVersionObj.Version +
-			                           ' (git hash: ' + loolwsdVersionObj.Hash + ')');
+			var h = loolwsdVersionObj.Hash;
+			if (parseInt(h,16).toString(16) === h.toLowerCase()) {
+				h = '<a target="_blank" href="https://gerrit.libreoffice.org/gitweb?p=online.git;a=commit;h=' + h + '">' + h + '</a>';
+				$('#loolwsd-version').html(loolwsdVersionObj.Version + ' (git hash: ' + h + ')');
+			}
+			else {
+				$('#loolwsd-version').text(loolwsdVersionObj.Version);
+			}
 
 			// TODO: For now we expect perfect match in protocol versions
 			if (loolwsdVersionObj.Protocol !== this.ProtocolVersionNumber) {
@@ -150,9 +156,13 @@ L.Socket = L.Class.extend({
 		}
 		else if (textMsg.startsWith('lokitversion ')) {
 			var lokitVersionObj = JSON.parse(textMsg.substring(textMsg.indexOf('{')));
-			$('#lokit-version').text(lokitVersionObj.ProductName + ' ' +
+			var h = lokitVersionObj.BuildId.substring(0, 7);
+			if (parseInt(h,16).toString(16) === h.toLowerCase()) {
+				h = '<a target="_blank" href="https://gerrit.libreoffice.org/gitweb?p=core.git;a=commit;h=' + h + '">' + h + '</a>';
+			}
+			$('#lokit-version').html(lokitVersionObj.ProductName + ' ' +
 			                         lokitVersionObj.ProductVersion + lokitVersionObj.ProductExtension.replace('.10.','-') +
-			                         ' (git hash: ' + lokitVersionObj.BuildId.substring(0, 7) + ')');
+			                         ' (git hash: ' + h + ')');
 		}
 		else if (textMsg.startsWith('perm:')) {
 			var perm = textMsg.substring('perm:'.length);


More information about the Libreoffice-commits mailing list