Completed ability to reply to posts

This commit is contained in:
socks 2018-02-18 13:51:49 +00:00
parent cf1259a311
commit 16a2507503
3 changed files with 8 additions and 7 deletions

View file

@ -137,7 +137,8 @@ def reply_to_post(post_id):
if request.method == "GET":
return render_template('reply.html', logged_in=logged_in, reply_to=timeline.post_details(post_id))
elif request.method == "POST":
pass
timeline.post_status(logged_in, request.form['status'], replyTo=post_id)
return redirect(url_for('profile'))
if __name__ == '__main__':

View file

@ -13,8 +13,8 @@ def post_status(username, content, private=False, replyTo=False, location=False)
accounts_mentioned = []
for word in content:
if word.startswith("@"):
if accounts_db.find({'username': username.lower()}).count > 0:
accounts_mentioned.append()
if accounts_db.find({'username': username.lower()}).count() > 0:
accounts_mentioned.append(word[1:])
status = {
'isRepost': False,
@ -25,7 +25,7 @@ def post_status(username, content, private=False, replyTo=False, location=False)
'likes': [],
'reposts': [],
'replies': [],
'replyTo': False or replyTo,
'replyTo': ObjectId(replyTo),
'hashtags': [x for x in content.split() if x.startswith("#")],
'location': False or location,
'private': False or private,

View file

@ -8,8 +8,8 @@
{{ reply_to.content }}
</div>
<div class="card-footer">
<form method="POST", action="/reply/{{ reply_to._id }}" class="form-inline">
<input type="text" class="form-inline form-control" value="@{{ reply_to.poster }} " autofocus onfocus="var temp_value=this.value; this.value=''; this.value=temp_value"/>
<form method="POST" action="/reply/{{ reply_to._id }}" class="form-inline">
<input type="text" name="status" class="form-inline form-control" value="@{{ reply_to.poster }} " autofocus onfocus="var temp_value=this.value; this.value=''; this.value=temp_value"/>
<input type="submit" class="btn btn-primary" value="Do Post" />
</form>
</div>