mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 16:01:58 +00:00
compose: Fix hardcoding of 'website' client.
We already do detection of the client on the backend based on User-Agent and the fact that it's a JSON view, which is pretty safe. This fixes an issue where the server was not treating the Electron app as its own client.
This commit is contained in:
@@ -34,14 +34,6 @@ function make_uploads_relative(content) {
|
|||||||
return content.replace(uploads_re, "]($1)");
|
return content.replace(uploads_re, "]($1)");
|
||||||
}
|
}
|
||||||
|
|
||||||
function client() {
|
|
||||||
if ((window.bridge !== undefined) &&
|
|
||||||
(window.bridge.desktopAppVersion !== undefined)) {
|
|
||||||
return "desktop app " + window.bridge.desktopAppVersion();
|
|
||||||
}
|
|
||||||
return "website";
|
|
||||||
}
|
|
||||||
|
|
||||||
// This function resets an input type="file". Pass in the
|
// This function resets an input type="file". Pass in the
|
||||||
// jquery object.
|
// jquery object.
|
||||||
function clear_out_file_list(jq_file_list) {
|
function clear_out_file_list(jq_file_list) {
|
||||||
@@ -335,14 +327,15 @@ function create_message_object() {
|
|||||||
var content = make_uploads_relative(compose.message_content());
|
var content = make_uploads_relative(compose.message_content());
|
||||||
|
|
||||||
// Changes here must also be kept in sync with echo.try_deliver_locally
|
// Changes here must also be kept in sync with echo.try_deliver_locally
|
||||||
var message = {client: client(),
|
var message = {
|
||||||
type: compose.composing(),
|
type: compose.composing(),
|
||||||
subject: subject,
|
subject: subject,
|
||||||
stream: compose.stream_name(),
|
stream: compose.stream_name(),
|
||||||
private_message_recipient: compose.recipient(),
|
private_message_recipient: compose.recipient(),
|
||||||
content: content,
|
content: content,
|
||||||
sender_id: page_params.user_id,
|
sender_id: page_params.user_id,
|
||||||
queue_id: page_params.event_queue_id};
|
queue_id: page_params.event_queue_id,
|
||||||
|
};
|
||||||
|
|
||||||
if (message.type === "private") {
|
if (message.type === "private") {
|
||||||
// TODO: this should be collapsed with the code in composebox_typeahead.js
|
// TODO: this should be collapsed with the code in composebox_typeahead.js
|
||||||
@@ -673,7 +666,6 @@ exports.test_send_many_messages = function (stream, subject, count) {
|
|||||||
message.to = stream;
|
message.to = stream;
|
||||||
message.subject = subject;
|
message.subject = subject;
|
||||||
message.content = num_sent.toString();
|
message.content = num_sent.toString();
|
||||||
message.client = client();
|
|
||||||
|
|
||||||
send_message(message);
|
send_message(message);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user