Make mobile bookmarklet work the same way as with desktop UI

This fixes that it fails when you call it without notes parameter.

closes #7698
This commit is contained in:
Benjamin Neff 2018-01-20 02:52:27 +01:00 committed by Dennis Schubert
parent a72feee812
commit f23966ef87
No known key found for this signature in database
GPG key ID: 5A0304BEA7966D7E
2 changed files with 11 additions and 5 deletions

View file

@ -7,6 +7,7 @@
## Bug fixes ## Bug fixes
* Fix invite link on the contacts page when the user has no contacts [#7690](https://github.com/diaspora/diaspora/pull/7690) * Fix invite link on the contacts page when the user has no contacts [#7690](https://github.com/diaspora/diaspora/pull/7690)
* Fixed the mobile bookmarklet when called without parameters [#7698](https://github.com/diaspora/diaspora/pull/7698)
## Features ## Features
* Check if redis is running in script/server [#7685](https://github.com/diaspora/diaspora/pull/7685) * Check if redis is running in script/server [#7685](https://github.com/diaspora/diaspora/pull/7685)

View file

@ -6,16 +6,21 @@ $(document).ready(function() {
return params.content; return params.content;
} }
var content = params.title + " - " + params.url; var separator = "\n\n";
if (params.notes.length > 0) { var contents = "### " + params.title + separator;
content += " - " + params.notes; if (params.notes) {
var notes = params.notes.toString().replace(/(?:\r\n|\r|\n)/g, "\n> ");
contents += "> " + notes + separator;
} }
return content; contents += params.url;
return contents;
} }
var content = publisherContent(gon.preloads.bookmarklet); var content = publisherContent(gon.preloads.bookmarklet);
if (content.length > 0) { if (content.length > 0) {
$("#status_message_text").val(content); var textarea = $("#status_message_text");
textarea.val(content);
autosize.update(textarea);
} }
}); });
// @license-end // @license-end