mirror of https://github.com/zulip/zulip.git
Use .attr() instead of .data() to access stream and subject names from the sidebar
The .data() method tries to coerce the value of the attribute into a Javascript type, which is not what we want when the stream name looks like a number or some other Javascript type. (imported from commit a5f639d2ef98435cec6beacf3837fc185474a955)
This commit is contained in:
parent
3b6713d545
commit
ea55ed5ebb
|
@ -1034,15 +1034,15 @@ $(function () {
|
|||
});
|
||||
|
||||
$('#stream_filters li').on('click', 'a.subscription_name', function (e) {
|
||||
var stream = $(e.target).parents('li').data('name');
|
||||
var stream = $(e.target).parents('li').attr('data-name');
|
||||
narrow.by('stream', stream, {select_first_unread: true});
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$('#stream_filters').on('click', '.expanded_subject a', function (e) {
|
||||
var stream = $(e.target).parents('ul').data('stream');
|
||||
var subject = $(e.target).parents('li').data('name');
|
||||
var stream = $(e.target).parents('ul').attr('data-stream');
|
||||
var subject = $(e.target).parents('li').attr('data-name');
|
||||
|
||||
narrow.activate([['stream', stream],
|
||||
['subject', subject]],
|
||||
|
@ -1053,7 +1053,6 @@ $(function () {
|
|||
|
||||
$('#stream_filters').on('click', '.streamlist_expand', function (e) {
|
||||
var stream_li = $(e.target).parents('li');
|
||||
var stream = stream_li.data('name');
|
||||
|
||||
$('ul.expanded_subjects', stream_li).toggleClass('hidden');
|
||||
|
||||
|
@ -1384,7 +1383,7 @@ exports.update_recent_subjects = function () {
|
|||
}
|
||||
|
||||
$("#stream_filters > li").each(function (idx, elem) {
|
||||
var stream = $(elem).data('name');
|
||||
var stream = $(elem).attr('data-name');
|
||||
var expander = $('.streamlist_expand', elem);
|
||||
var subjects = recent_subjects[stream] || [];
|
||||
var subject_names = $.map(subjects, function (elem, idx) {
|
||||
|
|
Loading…
Reference in New Issue