Rename user_id(s)_supported_operators -> operators_supporting_id(s).

This commit is contained in:
Priyank Patel
2019-08-10 16:10:29 +00:00
committed by Tim Abbott
parent 99450f336c
commit 1edde4a989
2 changed files with 9 additions and 9 deletions

View File

@@ -109,8 +109,8 @@ function get_messages_success(data, opts) {
// or convert the emails string to user IDs directly into the Filter code
// because doing so breaks the app in various modules that expect emails string.
function handle_user_ids_supported_operators(data) {
var user_ids_supported_operators = ['pm-with'];
var user_id_supported_operators = ['sender', 'group-pm-with'];
var operators_supporting_ids = ['pm-with'];
var operators_supporting_id = ['sender', 'group-pm-with'];
if (data.narrow === undefined) {
return data;
@@ -118,11 +118,11 @@ function handle_user_ids_supported_operators(data) {
data.narrow = JSON.parse(data.narrow);
data.narrow = _.map(data.narrow, function (filter) {
if (user_ids_supported_operators.indexOf(filter.operator) !== -1) {
if (operators_supporting_ids.indexOf(filter.operator) !== -1) {
filter.operand = people.emails_strings_to_user_ids_array(filter.operand);
}
if (user_id_supported_operators.indexOf(filter.operator) !== -1) {
if (operators_supporting_id.indexOf(filter.operator) !== -1) {
var person = people.get_by_email(filter.operand);
if (person !== undefined) {
filter.operand = person.user_id;

View File

@@ -520,14 +520,14 @@ def narrow_parameter(json: str) -> OptionalNarrowListT:
# Make sure to sync this list to frontend also when adding a new operator.
# that supports user IDs. Relevant code is located in static/js/message_fetch.js
# in handle_user_ids_supported_operators function where you will need to update
# user_id_supported_operator, or user_ids_supported_operator array.
user_id_supported_operator = ['sender', 'group-pm-with']
user_ids_supported_operators = ['pm-with']
# operators_supporting_id, or operators_supporting_ids array.
operators_supporting_id = ['sender', 'group-pm-with']
operators_supporting_ids = ['pm-with']
operator = elem.get('operator', '')
if operator in user_id_supported_operator:
if operator in operators_supporting_id:
operand_validator = check_string_or_int
elif operator in user_ids_supported_operators:
elif operator in operators_supporting_ids:
operand_validator = check_string_or_int_list
else:
operand_validator = check_string