예제 #1
0
def allusers():
    userID = session['userID']
    users = usersfunctions.getAllUsers()
    reqs = friendsfunctions.getFriendRequests(userID)
    friendrequests = {}
    for req in reqs:
        #gewtting all the userts for the searchfriends functions
        friendrequests[req] = usersfunctions.getUser(req.senderID)
    preqs = friendsfunctions.getPendingFriendRequests(userID)
    pendingfriendrequests = {}
    for preq in preqs:
        pendingfriendrequests[preq] = usersfunctions.getUser(preq.receiverID)
    print(pendingfriendrequests)
    return render_template("friends.html", users=users, friendrequests=friendrequests, pendingfriendrequests=pendingfriendrequests)
예제 #2
0
def viewpost(postID):
    post = postsfunctions.getPost(postID)
    creator = postsfunctions.getCreator(postID)
    comment_data = commentsfunctions.getComments(postID)
    comments = {}
    for comment in comment_data:
        comments[comment] = usersfunctions.getUser(comment.userID)
    return render_template("post.html", post=post, creator=creator, comments=comments)
예제 #3
0
def searchfriends():
    #searchfunction in the webpage
    userID = session['userID']
    query = request.form['query']
    users = usersfunctions.searchUsers(query)
    reqs = friendsfunctions.getFriendRequests(userID)
    #looks through the entire doc to match ur search queary, no AI used to autofill or anythign fance
    friendrequests = {}
    for req in reqs:
        friendrequests[req] = usersfunctions.getUser(req.senderID)
    preqs = friendsfunctions.getPendingFriendRequests(userID)
    pendingfriendrequests = {}
    for preq in preqs:
        pendingfriendrequests[preq] = usersfunctions.getUser(preq.receiverID)
        #also showing if a request is pending under each frtiends
    #print(pendingfriendrequests)
    return render_template("friends.html", users=users, friendrequests=friendrequests, pendingfriendrequests=pendingfriendrequests)
예제 #4
0
def friends():
    userID = session['userID']
    friendslist = friendsfunctions.getFriends(userID)
    users = []
    #adding all the freinds in the database to the webpage
    for friend in friendslist:
        users.append(usersfunctions.getUser(friend.friendID))
    reqs = friendsfunctions.getFriendRequests(userID)
    friendrequests = {}
    #if requested or if you request update the page to shothat
    for req in reqs:
        friendrequests[req] = usersfunctions.getUser(req.senderID)
    preqs = friendsfunctions.getPendingFriendRequests(userID)
    pendingfriendrequests = {}
    for preq in preqs:
        pendingfriendrequests[preq] = usersfunctions.getUser(preq.receiverID)
    print(pendingfriendrequests)
    return render_template("friends.html", users=users, friendrequests=friendrequests, pendingfriendrequests=pendingfriendrequests)
예제 #5
0
def profile(userID):
    currentuserID = session['userID']
    if currentuserID == int(userID):
        return redirect(url_for('myfeed'))
        #custom vs standard feed
    else:
        user = usersfunctions.getUser(userID)
        isFriend = friendsfunctions.isFriend(currentuserID, userID)
        posts = postsfunctions.getUserPosts(user.userID)
        return render_template("profile.html", user=user, isFriend=isFriend, posts=posts)
예제 #6
0
def myfeed():
    userID = session['userID']
    user = usersfunctions.getUser(userID)
    posts = postsfunctions.getUserPosts(userID)
    return render_template("me.html", user=user, posts=posts)
예제 #7
0
def chat(contactID):
    contact = usersfunctions.getUser(contactID)
    chat = messagesfunctions.getMessages(session['userID'], contactID)
    return render_template("chat.html", userID = session['userID'], contact=contact, messages=chat)