Skip to content

Commit 6389884

Browse files
committed
fix unneeded ascii conversion for topics
1 parent 8f434df commit 6389884

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

js/build/embark.bundle.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,21 +293,21 @@ var EmbarkJS =
293293

294294
// do fromAscii to each topics unless it's already a string
295295
if (typeof topics === 'string') {
296-
topics = topics;
296+
_topics = [web3.fromAscii(topics)];
297297
} else {
298298
// TODO: replace with es6 + babel;
299299
var _topics = [];
300300
for (var i = 0; i < topics.length; i++) {
301301
_topics.push(web3.fromAscii(topics[i]));
302302
}
303-
topics = _topics;
304303
}
304+
topics = _topics;
305305

306306
var payload = JSON.stringify(data);
307307

308308
var message = {
309309
from: identity,
310-
topics: [web3.fromAscii(topics)],
310+
topics: topics,
311311
payload: web3.fromAscii(payload),
312312
ttl: ttl,
313313
priority: priority
@@ -320,15 +320,15 @@ var EmbarkJS =
320320
var topics = options.topic || options.topics;
321321

322322
if (typeof topics === 'string') {
323-
topics = [web3.fromAscii(topics)];
323+
_topics = [topics];
324324
} else {
325325
// TODO: replace with es6 + babel;
326326
var _topics = [];
327327
for (var i = 0; i < topics.length; i++) {
328-
_topics.push(web3.fromAscii(topics[i]));
328+
_topics.push(topics[i]);
329329
}
330-
topics = _topics;
331330
}
331+
topics = _topics;
332332

333333
var filterOptions = {
334334
topics: topics
@@ -355,7 +355,7 @@ var EmbarkJS =
355355
promise.error(err);
356356
} else {
357357
data = {
358-
topic: topics.map((t) => web3.toAscii(t)),
358+
topic: topics,
359359
data: payload,
360360
from: result.from,
361361
time: (new Date(result.sent * 1000))

js/embark.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,21 +246,21 @@ EmbarkJS.Messages.Whisper.sendMessage = function(options) {
246246

247247
// do fromAscii to each topics unless it's already a string
248248
if (typeof topics === 'string') {
249-
topics = topics;
249+
_topics = [web3.fromAscii(topics)];
250250
} else {
251251
// TODO: replace with es6 + babel;
252252
var _topics = [];
253253
for (var i = 0; i < topics.length; i++) {
254254
_topics.push(web3.fromAscii(topics[i]));
255255
}
256-
topics = _topics;
257256
}
257+
topics = _topics;
258258

259259
var payload = JSON.stringify(data);
260260

261261
var message = {
262262
from: identity,
263-
topics: [web3.fromAscii(topics)],
263+
topics: topics,
264264
payload: web3.fromAscii(payload),
265265
ttl: ttl,
266266
priority: priority
@@ -273,15 +273,15 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
273273
var topics = options.topic || options.topics;
274274

275275
if (typeof topics === 'string') {
276-
topics = [web3.fromAscii(topics)];
276+
_topics = [topics];
277277
} else {
278278
// TODO: replace with es6 + babel;
279279
var _topics = [];
280280
for (var i = 0; i < topics.length; i++) {
281-
_topics.push(web3.fromAscii(topics[i]));
281+
_topics.push(topics[i]);
282282
}
283-
topics = _topics;
284283
}
284+
topics = _topics;
285285

286286
var filterOptions = {
287287
topics: topics
@@ -308,7 +308,7 @@ EmbarkJS.Messages.Whisper.listenTo = function(options) {
308308
promise.error(err);
309309
} else {
310310
data = {
311-
topic: topics.map((t) => web3.toAscii(t)),
311+
topic: topics,
312312
data: payload,
313313
from: result.from,
314314
time: (new Date(result.sent * 1000))

0 commit comments

Comments
 (0)