mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 15:09:34 +00:00
Cleanup MIT hardcoding for disabling presence.
This commit is contained in:
@@ -216,8 +216,8 @@ function filter_and_sort(users) {
|
|||||||
exports._filter_and_sort = filter_and_sort;
|
exports._filter_and_sort = filter_and_sort;
|
||||||
|
|
||||||
exports.update_users = function (user_list) {
|
exports.update_users = function (user_list) {
|
||||||
if (page_params.domain === 'mit.edu') {
|
if (page_params.presence_disabled) {
|
||||||
return; // MIT realm doesn't have a presence list
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var users = exports.presence_info;
|
var users = exports.presence_info;
|
||||||
@@ -278,8 +278,8 @@ function actually_update_users_for_search() {
|
|||||||
var update_users_for_search = _.throttle(actually_update_users_for_search, 50);
|
var update_users_for_search = _.throttle(actually_update_users_for_search, 50);
|
||||||
|
|
||||||
exports.update_huddles = function () {
|
exports.update_huddles = function () {
|
||||||
if (page_params.domain === 'mit.edu') {
|
if (page_params.presence_disabled) {
|
||||||
return; // MIT realm doesn't have a presence list
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var section = $('#group-pm-list').expectOne();
|
var section = $('#group-pm-list').expectOne();
|
||||||
|
|||||||
@@ -488,8 +488,7 @@ $(function () {
|
|||||||
$("#edit-message-hotkey-help").hide();
|
$("#edit-message-hotkey-help").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some MIT-specific customizations
|
if (page_params.presence_disabled) {
|
||||||
if (page_params.domain === 'mit.edu') {
|
|
||||||
$("#user-list").hide();
|
$("#user-list").hide();
|
||||||
$("#group-pm-list").hide();
|
$("#group-pm-list").hide();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2653,7 +2653,7 @@ def gather_subscriptions(user_profile):
|
|||||||
def get_status_dict(requesting_user_profile):
|
def get_status_dict(requesting_user_profile):
|
||||||
# type: (UserProfile) -> Dict[text_type, Dict[text_type, Dict[str, Any]]]
|
# type: (UserProfile) -> Dict[text_type, Dict[text_type, Dict[str, Any]]]
|
||||||
# Return no status info for MIT
|
# Return no status info for MIT
|
||||||
if requesting_user_profile.realm.domain == 'mit.edu':
|
if requesting_user_profile.realm.presence_disabled:
|
||||||
return defaultdict(dict)
|
return defaultdict(dict)
|
||||||
|
|
||||||
return UserPresence.get_status_dict_by_realm(requesting_user_profile.realm_id)
|
return UserPresence.get_status_dict_by_realm(requesting_user_profile.realm_id)
|
||||||
|
|||||||
@@ -188,6 +188,11 @@ class Realm(ModelReprMixin, models.Model):
|
|||||||
# TODO: Change return type to QuerySet[UserProfile]
|
# TODO: Change return type to QuerySet[UserProfile]
|
||||||
return UserProfile.objects.filter(realm=self, is_active=True).select_related()
|
return UserProfile.objects.filter(realm=self, is_active=True).select_related()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def presence_disabled(self):
|
||||||
|
# type: () -> bool
|
||||||
|
return self.domain == "mit.edu"
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
permissions = (
|
permissions = (
|
||||||
('administer', "Administer a realm"),
|
('administer', "Administer a realm"),
|
||||||
|
|||||||
@@ -1525,7 +1525,7 @@ class UserPresenceTests(AuthedTestCase):
|
|||||||
|
|
||||||
def test_no_mit(self):
|
def test_no_mit(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
"""MIT never gets a list of users"""
|
"""Zephyr mirror realms such as MIT never get a list of users"""
|
||||||
self.login("espuser@mit.edu")
|
self.login("espuser@mit.edu")
|
||||||
result = self.client.post("/json/users/me/presence", {'status': 'idle'})
|
result = self.client.post("/json/users/me/presence", {'status': 'idle'})
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
@@ -1796,6 +1796,7 @@ class HomeTest(AuthedTestCase):
|
|||||||
"password_auth_enabled",
|
"password_auth_enabled",
|
||||||
"people_list",
|
"people_list",
|
||||||
"poll_timeout",
|
"poll_timeout",
|
||||||
|
"presence_disabled",
|
||||||
"product_name",
|
"product_name",
|
||||||
"prompt_for_invites",
|
"prompt_for_invites",
|
||||||
"realm_allow_message_editing",
|
"realm_allow_message_editing",
|
||||||
|
|||||||
@@ -999,6 +999,7 @@ def home(request):
|
|||||||
avatar_url = avatar_url(user_profile),
|
avatar_url = avatar_url(user_profile),
|
||||||
mandatory_topics = user_profile.realm.mandatory_topics,
|
mandatory_topics = user_profile.realm.mandatory_topics,
|
||||||
show_digest_email = user_profile.realm.show_digest_email,
|
show_digest_email = user_profile.realm.show_digest_email,
|
||||||
|
presence_disabled = user_profile.realm.presence_disabled,
|
||||||
)
|
)
|
||||||
if narrow_stream is not None:
|
if narrow_stream is not None:
|
||||||
# In narrow_stream context, initial pointer is just latest message
|
# In narrow_stream context, initial pointer is just latest message
|
||||||
|
|||||||
Reference in New Issue
Block a user