« first day (133 days earlier)      last day (501 days later) » 

12:28 AM
@Mego is parent_comment the ID of the parent comment?
 
Anonymous
@Downgoat parent_id. parent is a reference to the parent
 
I mean in the POST /post/id/comment route
 
Anonymous
Oh
 
Anonymous
Yes
 
Anonymous
It's nullable, so passing in nothing means it's a top-level
 
12:39 AM
JavaScript: the interpreted language which takes longer to compile than C
 
1:36 AM
@Mego Incorrect integer value: 'null' for column 'parent_id' at row 1
seems to not be nullable?
 
Anonymous
It should be...
 
Anonymous
nullable=True on both
 
:|
 
Anonymous
Remember that None is null in Python
 
any idea how to fix this?
 
Anonymous
1:40 AM
Gimme teh codez
 
frontend code is just this:
export default class Comment extends Request {
    /**
     * Gets leaderboard for a post id
     * @param {string} type - `post` or `answer`
     * @param {number|string} id - Id of post or answer
     * @param {string} value - Actual content of comment
     * @param {?number} parentComment - The id of the parent comment
     */
    constructor({ type, id, value, parentComment = null }) {
        super({
            path: `/${type}/${id}/comment`,
            method: HTTPMethod.POST,
            formData: {
 
Anonymous
Don't include parent_comment in the request data if it's null
 
I checked though and python does decode me sending a null to None though
 
Anonymous
Weird
 
Anonymous
Lemme look at the route
 
Anonymous
1:46 AM
I don't see anything weird with it
 
Anonymous
OHH
 
Anonymous
It's trying to pass in 'null' instead of the SQL constant NULL for some reason
 
> sqlalchemy.exc.InvalidRequestError: On relationship PostComment.parent, 'dynamic' loaders cannot be used with many-to-one/one-to-one relationships and/or uselist=False.
:(
 
Anonymous
What
 
I can't apparently do .comments.limit(x)
so not sure how to get comments from flask
 
Anonymous
1:54 AM
PostComment.filter_by(post_id = post_id and parent_id is None).limit(5)?
 
though I can't reference PostComment from flask template
 
Anonymous
Shouldn't have to do that roundabout though
 
Anonymous
Hmm
 
Anonymous
Query the comments in the route for the post and pass them in to the template, like answers for post?
 
though I'd have to generate a super-weird array though and keep that correctly sync'd with the list/order of answers
 
Anonymous
2:05 AM
Just pass the current ones in for now
 
Anonymous
We can deal with e.g. websockets for syncing later
 
So I was thinking if you want to link to a specific commen thread, you could then just do /comment/<comment id> and that'll load a seperate page with just the thread and ability to go up the thread
kinda like reddit
@Mego what is best way to nested comments in Python then, without creating a seperate class? In JS I would make an object
 
owow ok
 
@Mego why not tuples?
oh, nevermind
the outer one could be a tuple though no
 
Anonymous
2:15 AM
@quartata It makes no difference
 
@Mego when doing AnswerComment.query.filter_by(post_id=post_id, parent_id=None).order_by(AnswerComment.date_created.desc()).limit(5), is there a better way to know if they are more than 5 answer comments (so I know when to show "load more") rather than doing another query?
We are already doing a ton of DB queries for post/<id> so i dont want to add too many more
 
Anonymous
Not that I know of...
 
2:35 AM
good news: basic comments work
 
 
2 hours later…
4:22 AM
ok two variants of comment:
this one has a line on the left
this one doesn't
which one is better? (I still have a lot to add so i am aware a lot of things are missing)
 
4:57 AM
@Mego in the AnswerComment model, you have:
 'date': self.date_created,
but python datetimes are not JSON serializable?
has this to_json been tested, it seems to not be serializing ORM objects :/
Also @Mego this line: parent_comment = request.form.get("parent_comment", None) is giving a 400 when parent_comment is not sent
 
5:52 AM
not ready for merging htough
 
6:37 AM
@Downgoat imo the one without the leading line is better
 
6:53 AM
hm, not sure about leading space with byte count
does it look fine as is?
 
 
9 hours later…
Anonymous
4:07 PM
@Downgoat They should serialize as an ISO 8601 timestamp
 
Anonymous
Weird
 
Anonymous
4:22 PM
@Downgoat Reviewed
 
5:03 PM
btw whats the progress with the nginx server atm?
 
Anonymous
Still not sure why it's not working
 
could I have access to sudo systemctl and /var/log to take a look?
 
Anonymous
Mar 18 17:05:55 ppcg-v2 uwsgi[5127]: webassets.exceptions.FilterError: uglifyjs: subprocess returned a non-success result code: 127, stdout=b'', stderr=b"/usr/bin/env: 'node': No such file or directory\n"
 
Anonymous
That's the issue, but it certainly does exist
 
oic
does the user running the app have exec perms to /usr/bin
 
Anonymous
5:07 PM
Yeah
 
Anonymous
It's me (not secure - I need to change that)
 
@Mego could you run curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
and then sudo apt-get install -y nodejs
 
Anonymous
I think I found the issue
 
Anonymous
5:33 PM
@Downgoat Still borked: webassets.exceptions.FilterError: uglifyjs: subprocess returned a non-success result code: 127, stdout=b'', stderr=b'/usr/bin/env: \xe2\x80\x98node\xe2\x80\x99: No such file or directory\n'
 
Anonymous
(venv) mego@ppcg-v2:/var/www/ppcg-v2$ which node
/usr/bin/node
 
@Mego O_o are those unprintables suppose to be there
 
Anonymous
Probably not
 
did you run the above commands?
 
Anonymous
They weren't there before
 
Anonymous
5:37 PM
No, because it shouldn't be the node installation being broken
 
Anonymous
The node install works fine, and was done in exactly the same way as on the old server
 
they dont seem to exist in the actual file itself
 
Anonymous
Oh it's just pretty quotes from the output
 
Anonymous
‘node’
 
Anonymous
That's just how /usr/bin/env is formatting it in the error message
 
5:39 PM
@Mego The ubuntu default node version is 4.x so most of the js code wont even compile
 
Anonymous
(venv) mego@ppcg-v2:/var/www/ppcg-v2$ node -v
v4.2.6
 
$ ./node_modules/.bin/uglifyjs --help

  Usage: uglifyjs [options] [files...]

  Options:

    -V, --version                output the version number
    -p, --parse <options>        Specify parser options.
    -c, --compress [options]     Enable compressor/specify compressor options.
    -m, --mangle [options]       Mangle names/specify mangler options.
    --mangle-props [options]     Mangle properties/specify mangler options.
    -b, --beautify [options]     Beautify output/specify output options.
:|
ubuntu y u do dis
@Mego whats the CWD of the process?
 
Anonymous
@Downgoat /var/www/ppcg-v2
 
@Mego could you try running now and see what output is?
 
Anonymous
Installing node from source now
 
Anonymous
5:43 PM
8.10.0 LTS
 
Anonymous
virtual memory exhausted: Cannot allocate memory
 
Anonymous
Oh dear
 
>_<
 
Anonymous
Cheap droplet problems :P
 
i think nvm might have precompiled binaries brb
oh rip nginx is down
 
Anonymous
5:46 PM
It does but I wanted to build from source to ensure that it works
 
Anonymous
Yeah I shut down nginx, our service, and mysql
 
Anonymous
To save memory for compilation
 
ah ok
 
Anonymous
6:39 PM
@Downgoat It lives. Installing 8.10.0 was the key
 
8:17 PM
hopefully this is cleaner
 
8:38 PM
: When I click 'Sign in with Stack Exchange', it shows this message: Couldn't parse `client_id`
 
Anonymous
8:50 PM
@cairdcoinheringaahing Yeah @Downgoat needs to set up the oauth stuff
 

« first day (133 days earlier)      last day (501 days later) »