From 9f7236eec1c16fe8333824612520b410d3a00046 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 9 May 2017 22:20:47 -0700 Subject: [PATCH] message: Remove unused old gravatar_hash field from message dicts. This was deprecated and replaced some 4 years ago. --- templates/zerver/api_content.json | 2 -- tools/zulip-export/zulip-export | 2 +- zerver/lib/bugdown/__init__.py | 1 - zerver/lib/message.py | 2 -- zerver/tests/test_events.py | 1 - zerver/tests/test_narrow.py | 2 -- 6 files changed, 1 insertion(+), 9 deletions(-) diff --git a/templates/zerver/api_content.json b/templates/zerver/api_content.json index 941ac0975b..5580708417 100644 --- a/templates/zerver/api_content.json +++ b/templates/zerver/api_content.json @@ -83,7 +83,6 @@ 'sender_short_name': 'othello-bot', 'sender_realm_str': 'example', 'content': 'Something is rotten in the state of Denmark.', - 'gravatar_hash': '17d93357cca1e793739836ecbc7a9bf7', 'recipient_id': 12314, 'client': 'website', 'subject_links': [], @@ -108,7 +107,6 @@ 'sender_short_name': 'othello-bot', 'sender_realm_str': 'example', 'content': 'I come not, friends, to steal away your hearts.', - 'gravatar_hash': '17d93357cca1e793739836ecbc7a9bf7', 'recipient_id': 18391, 'client': 'website', 'subject_links': [], diff --git a/tools/zulip-export/zulip-export b/tools/zulip-export/zulip-export index 4d70c490e1..f6cfd25843 100755 --- a/tools/zulip-export/zulip-export +++ b/tools/zulip-export/zulip-export @@ -79,7 +79,7 @@ for msg in result['messages']: if msg['type'] != 'stream': continue # Remove extraneous metadata - for k in ['flags', 'edit_history', 'subject_links', 'gravatar_hash', + for k in ['flags', 'edit_history', 'subject_links', 'avatar_url', 'recipient_id', 'sender_short_name', 'content_type', 'client', 'sender_realm_str', 'id', 'type']: msg.pop(k, None) diff --git a/zerver/lib/bugdown/__init__.py b/zerver/lib/bugdown/__init__.py index a6df6ba91e..44e5313d3f 100644 --- a/zerver/lib/bugdown/__init__.py +++ b/zerver/lib/bugdown/__init__.py @@ -29,7 +29,6 @@ import requests from django.core import mail from django.conf import settings -from zerver.lib.avatar_hash import gravatar_hash from markdown.extensions import codehilite from zerver.lib.bugdown import fenced_code from zerver.lib.bugdown.fenced_code import FENCE_RE diff --git a/zerver/lib/message.py b/zerver/lib/message.py index 661ff4958b..d2bcb6ab77 100644 --- a/zerver/lib/message.py +++ b/zerver/lib/message.py @@ -10,7 +10,6 @@ from six import binary_type from typing import Set, Text from zerver.lib.avatar import avatar_url_from_dict -from zerver.lib.avatar_hash import gravatar_hash import zerver.lib.bugdown as bugdown from zerver.lib.cache import cache_with_key, to_dict_cache_key from zerver.lib.request import JsonableError @@ -194,7 +193,6 @@ class MessageDict(object): recipient_id = recipient_id, subject = subject, timestamp = datetime_to_timestamp(pub_date), - gravatar_hash = gravatar_hash(sender_email), # Deprecated June 2013 avatar_url = avatar_url, client = sending_client_name) diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py index 9d989a8c81..15025c7d29 100644 --- a/zerver/tests/test_events.py +++ b/zerver/tests/test_events.py @@ -444,7 +444,6 @@ class EventsRegisterTest(ZulipTestCase): ('content', check_string), ('content_type', equals('text/html')), ('display_recipient', check_string), - ('gravatar_hash', check_string), ('is_mentioned', check_bool), ('reactions', check_list(None)), ('recipient_id', check_int), diff --git a/zerver/tests/test_narrow.py b/zerver/tests/test_narrow.py index 6775986712..d2b1405e46 100644 --- a/zerver/tests/test_narrow.py +++ b/zerver/tests/test_narrow.py @@ -413,8 +413,6 @@ class GetOldMessagesTest(ZulipTestCase): "avatar_url", "recipient_id", "sender_full_name", "sender_short_name", "timestamp", "reactions"): self.assertIn(field, message) - # TODO: deprecate soon in favor of avatar_url - self.assertIn('gravatar_hash', message) return result