Skip to content
This repository was archived by the owner on Jun 9, 2021. It is now read-only.

Commit 498507e

Browse files
committed
handle missing irc_nick
1 parent f0e2dc3 commit 498507e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Diff for: server.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,20 @@ def get(self, username):
177177
user = yield self.db.get_user_by('username', username)
178178
github_id = user['github_id']
179179
contact_info = yield self.db.get_contact_info(github_id)
180+
avatar_url = self.avatar_url(user['username'], contact_info[db.ContactInfoType.EMAIL])
181+
irc_nick = contact_info.get(db.ContactInfoType.IRC)
182+
180183
mentor = questions = answers = None
181184
mentees = []
182-
183185
if user['is_mentor']:
184186
mentees = yield self.db.get_mentees(user)
185187
else:
186188
mentor = yield self.db.get_mentor(github_id)
187189
if self.current_user and self.current_user['is_mentor']:
188190
questions, answers = yield self.db.get_questionnaire(github_id)
189191

190-
self.render('profile.html', user=user, avatar_url=self.avatar_url(user['username'], contact_info[db.ContactInfoType.EMAIL]),
191-
mentor=mentor, mentees=mentees, questions=questions, answers=answers, note=user['note'],
192-
irc_nickname=contact_info[db.ContactInfoType.IRC])
192+
self.render('profile.html', user=user, avatar_url=avatar_url, mentor=mentor, mentees=mentees,
193+
questions=questions, answers=answers, note=user['note'], irc_nick=irc_nick)
193194

194195
class AccountHandler(BaseHandler):
195196
@tornado.web.authenticated

Diff for: templates/profile.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<div class="col-md-5">
1414
<h1>{{ user['username'] }}</h1>
1515
<p id="profile-link"><a href="https://github.com/{{ user['username'] }}?tab=repositories">GitHub profile</a></p>
16-
{% if irc_nickname %}
17-
<p id="irc-nickname"><b>IRC:</b> <code>{{ irc_nickname }}</code></p>
16+
{% if irc_nick %}
17+
<p id="irc-nickname"><b>IRC:</b> <code>{{ irc_nick }}</code></p>
1818
{% end %}
1919
{% if user['is_mentor'] %}
2020
<h2>Mentees</h2>

0 commit comments

Comments
 (0)