diasporadiaries

a platform for writing stories with personal accounts and messages
git clone git://parazyd.org/diasporadiaries.git
Log | Files | Refs | Submodules | README | LICENSE

commit 905475f445823cd50ceb40bf8c1e072afbdab240
parent c818242bdcc5af7519d7b9eabf19cb001106ad55
Author: parazyd <parazyd@dyne.org>
Date:   Tue, 22 Jan 2019 16:33:22 +0100

Simplify /profile route.

Diffstat:
Mdiaspora.py | 15+++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/diaspora.py b/diaspora.py @@ -325,17 +325,12 @@ def profile(): """ uid = request.args.get('id') if uid: - email = sql_select_col_where('email', 'id', uid, table='users') - if email: - email = email[0][0] - stories = get_multiple_stories_filtered('email', email, + user = find_user_by_id(uid) + if user: + stories = get_multiple_stories_filtered('email', user['email'], ('visible', 1)) - if stories: - name = stories[0]['name'] - return render_template('profile.html', stories=stories, - name=name, uid=uid, profiles={}) - return render_template('profile.html', stories=[], name='Someone', - uid=uid, profiles={}) + return render_template('profile.html', name=user['name'], uid=uid, + stories=stories, profiles={}) return render_template('fail.html', msg='No such profile.')