forked from gergely/calendar-social
[Bugfix] Fix user follow
* The link didn’t have a closing tag * The whole mechanism didn’t work I probably submitted a previous patch…
This commit is contained in:
parent
3bd381692b
commit
6657cc1c91
@ -259,9 +259,9 @@ class CalendarSocialApp(Flask):
|
|||||||
|
|
||||||
from .models import Profile, User
|
from .models import Profile, User
|
||||||
|
|
||||||
profile = current_user.profile
|
try:
|
||||||
|
profile = Profile.query.join(User).filter(User.username == username).one()
|
||||||
if profile is None:
|
except NoResultFound:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
return render_template('profile-details.html', profile=profile)
|
return render_template('profile-details.html', profile=profile)
|
||||||
@ -274,14 +274,14 @@ class CalendarSocialApp(Flask):
|
|||||||
|
|
||||||
from .models import db, Profile, User, UserFollow, Notification, NotificationAction
|
from .models import db, Profile, User, UserFollow, Notification, NotificationAction
|
||||||
|
|
||||||
profile = current_user.profile
|
try:
|
||||||
|
profile = Profile.query.join(User).filter(User.username == username).one()
|
||||||
if profile is None:
|
except NoResultFound:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
if profile.user != current_user:
|
if profile.user != current_user:
|
||||||
follow = UserFollow(follower_id=current_user.profile,
|
follow = UserFollow(follower=current_user.profile,
|
||||||
followed_id=profile,
|
followed=profile,
|
||||||
accepted_at=datetime.utcnow())
|
accepted_at=datetime.utcnow())
|
||||||
db.session.add(follow)
|
db.session.add(follow)
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<small>@{{ profile.user.username}}</small>
|
<small>@{{ profile.user.username}}</small>
|
||||||
</h1>
|
</h1>
|
||||||
{% if profile.user != current_user %}
|
{% if profile.user != current_user %}
|
||||||
<a href="{{ url_for('follow_user', username=profile.user.username) }}">{% trans %}Follow{% endtrans %}
|
<a href="{{ url_for('follow_user', username=profile.user.username) }}">{% trans %}Follow{% endtrans %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
|
Loading…
Reference in New Issue
Block a user