mail: display user as unknown if it doesn't exist anymore (#13923)
This commit is contained in:
parent
f45a55dc57
commit
27dc0bd814
|
@ -15,6 +15,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import re
|
||||
import requests
|
||||
import subprocess
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -98,7 +99,10 @@ class Mail(models.Model):
|
|||
def contact_name(self):
|
||||
if not self.contact_id:
|
||||
return ''
|
||||
user_details = get_wcs_data('api/users/%s/' % self.contact_id)
|
||||
try:
|
||||
user_details = get_wcs_data('api/users/%s/' % self.contact_id)
|
||||
except requests.HTTPError:
|
||||
return _('unknown')
|
||||
return user_details.get('user_display_name')
|
||||
|
||||
def html_note(self):
|
||||
|
|
Loading…
Reference in New Issue