mirror of
https://github.com/zulip/zulip.git
synced 2025-11-22 07:21:23 +00:00
Make "subject" an alias for the "topic" operator.
(imported from commit 52c11ff48a286533906b99ed62839e6ae3e35b17)
This commit is contained in:
@@ -39,7 +39,7 @@ $(function () {
|
||||
|
||||
var operators = event.filter.operators();
|
||||
var stream_operands = event.filter.operands('stream');
|
||||
var subject_operands = event.filter.operands('subject');
|
||||
var subject_operands = event.filter.operands('topic');
|
||||
var reported_operators;
|
||||
if (operators.length === 1) {
|
||||
reported_operators = operators[0][0];
|
||||
|
||||
@@ -10,7 +10,7 @@ function Filter(operators) {
|
||||
}
|
||||
}
|
||||
|
||||
var canonical_operators = {"from": "sender"};
|
||||
var canonical_operators = {"from": "sender", "subject": "topic"};
|
||||
|
||||
exports.canonicalize_operator = function (operator) {
|
||||
operator = operator.toLowerCase();
|
||||
@@ -166,7 +166,7 @@ Filter.prototype = {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'subject':
|
||||
case 'topic':
|
||||
if ((message.type !== 'stream') ||
|
||||
(message.subject.toLowerCase() !== operand))
|
||||
return false;
|
||||
@@ -294,7 +294,7 @@ exports.set_compose_defaults = function (opts) {
|
||||
|
||||
// Set the stream, subject, and/or PM recipient if they are
|
||||
// uniquely specified in the narrow view.
|
||||
$.each(['stream', 'subject'], function (idx, key) {
|
||||
$.each(['stream', 'topic'], function (idx, key) {
|
||||
if (single[key] !== undefined)
|
||||
opts[key] = single[key];
|
||||
});
|
||||
@@ -497,7 +497,7 @@ exports.by_subject = function (target_id, opts) {
|
||||
opts = $.extend({}, {then_select_id: target_id}, opts);
|
||||
exports.activate([
|
||||
['stream', original.stream],
|
||||
['subject', original.subject]
|
||||
['topic', original.subject]
|
||||
], opts);
|
||||
};
|
||||
|
||||
@@ -656,7 +656,7 @@ exports.narrowed_by_reply = function () {
|
||||
current_filter.operands("pm-with").length === 1) ||
|
||||
(operators.length === 2 &&
|
||||
current_filter.operands("stream").length === 1 &&
|
||||
current_filter.operands("subject").length === 1));
|
||||
current_filter.operands("topic").length === 1));
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
@@ -60,8 +60,8 @@ function describe(operators) {
|
||||
case 'stream':
|
||||
return 'Narrow to stream ' + operand;
|
||||
|
||||
case 'subject':
|
||||
return 'Narrow to subject ' + operand;
|
||||
case 'topic':
|
||||
return 'Narrow to topic ' + operand;
|
||||
|
||||
case 'sender':
|
||||
return 'Narrow to sender ' + operand;
|
||||
|
||||
@@ -190,7 +190,7 @@ exports.update_streams_sidebar = function () {
|
||||
}
|
||||
|
||||
var op_stream = narrow.filter().operands('stream');
|
||||
var op_subject = narrow.filter().operands('subject');
|
||||
var op_subject = narrow.filter().operands('topic');
|
||||
var subject;
|
||||
if (op_stream.length !== 0) {
|
||||
if (op_subject.length !== 0) {
|
||||
@@ -281,7 +281,7 @@ $(function () {
|
||||
var op_stream = event.filter.operands('stream');
|
||||
if (op_stream.length !== 0 && subs.is_subscribed(op_stream[0])) {
|
||||
var stream_li = get_filter_li('stream', op_stream[0]);
|
||||
var op_subject = event.filter.operands('subject');
|
||||
var op_subject = event.filter.operands('topic');
|
||||
var subject;
|
||||
if (op_subject.length !== 0) {
|
||||
subject = op_subject[0];
|
||||
|
||||
@@ -68,9 +68,9 @@ function make_tab_data() {
|
||||
|
||||
// Third breadcrumb item for stream-subject naarrows
|
||||
if (filter.has_operator("stream") &&
|
||||
filter.has_operator("subject")) {
|
||||
filter.has_operator("topic")) {
|
||||
stream = filter.operands("stream")[0];
|
||||
var subject = filter.operands("subject")[0];
|
||||
var subject = filter.operands("topic")[0];
|
||||
hashed = hashchange.operators_to_hash(ops.slice(0, 2));
|
||||
|
||||
tabs.push(make_tab(subject, hashed, null));
|
||||
|
||||
@@ -1205,7 +1205,7 @@ $(function () {
|
||||
var subject = $(e.target).parents('li').attr('data-name');
|
||||
|
||||
narrow.activate([['stream', stream],
|
||||
['subject', subject]],
|
||||
['topic', subject]],
|
||||
{select_first_unread: true, trigger: 'sidebar'});
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
@@ -702,7 +702,7 @@ class NarrowBuilder(object):
|
||||
recipient = get_recipient(Recipient.STREAM, type_id=stream.id)
|
||||
return self.pQ(recipient=recipient)
|
||||
|
||||
def by_subject(self, operand):
|
||||
def by_topic(self, operand):
|
||||
return self.pQ(subject__iexact=operand)
|
||||
|
||||
def by_sender(self, operand):
|
||||
|
||||
Reference in New Issue
Block a user