Guest posts seem a little broken.


  • GIFs_WebMs_35hz_Drum_n_Bass_Community_-_2014-07-19_14.50.40.png

    After a guest post is a </ul>, so the rest of that page is broken.

    Wasn't like this before.

    Link to that post http://35hz.co.uk/topic/12/gifs-webms/27

  • NodeBB

    Tested on my dev and seems fine, could be the changes you made to the templates. Can you test by removing the usernames under user pictures?


  • @baris Just tried that as I thought it could be related. Didn't make a difference unfortunately. 😕 Will remove it and try updating themes etc.

    EDIT: Updated to latest, removed topic.tpl code that I'd added. Still the same. If removing them is easier, I don't mind doing that. They're only posts from ex members of my old forum anyway. 😆

  • NodeBB

    Is there anything special in that posts content? Does it break on all guest posts?


  • @baris That specific post contains URLs to gfycat (embedding is disabled at the minute). I'm not sure where to look for other guest posts, but I'll have a look and see what I can find.

  • NodeBB

    You can just try posting as guest and see if it breaks with simple text posts.


  • @baris Good thinking, created a new post in another topic as a guest, worked fine. Definitely seems to be something with the old guest posts, if I delete that post, there's another further down the page that it will break at. I deleted two posts further up until I realised.

  • NodeBB

    Can you post the raw content of those posts that are breaking? Either here or a link to pastebin.


  • @baris

    that costume :ana:

    :ana: was an old smilie that we don't use on the new forum. I've tried editing the post etc, nothing changes.

    Could this be an issue I didn't spot from when I changed the guest ID to 0 a few months back in another of my topics?

    But then I don't see why it's adding </ul></div> to the end of a guest post because of that. scratches head

    I don't mind deleting them if that will be easier. (However I do that)

  • NodeBB

    @a_5mith said:

    that costume :ana:

    1. Can you reproduce the issue if you post the same content as a registered user?
    2. As a guest?

  • @baris It's not just that post unfortunately, there's another one here:

    The contents of that post are in this pastebin

  • NodeBB

    I assume it is fixed if you edit the post content and replace it with something simple? It could be a plugin that outputs bad html or a bug in templates.js, seems to work fine if I post that same content as a new post.


  • Ok, I've worked it out, it's because the UID is "undefined", thought I'd fixed all of these in this topic but apparently not.

    Is there a quick way of changing all uids from undefined to 0? Or do I need to find the pid, then hset post uid :0 for each one?

  • NodeBB

    If you want you can run a one time script to fix the uids, backup your database before running it and then add the following code here

    router.get('/fixguestposts', function (req, res) {
    	var async = require('async'),
    		db = require('../database');
    
    	function fixOwner(pid, next) {
    		posts.getPostField(pid, 'uid', function(err, uid) {
    			if (err) {
    				return next(err);
    			}
    			if (parseInt(uid, 10) >= 0) {
    				return next();
    			}
    			posts.setPostField(pid, 'uid', 0, next);
    		});
    	}
    
    	db.getSortedSetRange('posts:pid', 0, -1, function(err, pids) {
    		if (err) {
    			res.json(500, err.message);
    		}
    
    		async.eachLimit(pids, 10, fixOwner, function(err) {
    			if (err) {
    				res.json(500, err.message);
    			}
    				
    			res.json(200, 'done');
    		});
    	});
    });
    

    Run the forum in dev mode and browse to http://35hz.co.uk/debug/fixguestposts It will go through every post and check their uid if its greater or equal to 0 it won't do anything, if not (ie undefined null) it will set it to 0.


  • @baris Is there a best way to backup redis? Or is sudo cp -b dump.rdb /home/a_5mith/backup/ sufficient?

  • NodeBB

    Do a

    redis-cli
    BGSAVE
    

    before copying.


  • @baris Yeah I'm doing that now, not sure when it's done though. 😆 Noticed a script that waits 15 minutes, but not sure if that's just to make sure.

  • NodeBB

    You can use LASTSAVE to check the timestamp of last successful BGSAVE


  • @baris Yeah it's done. 👍 Right, will backup then add the code in to debug, I'm good to remove it after?

  • NodeBB

    You can remove it after it's done.

Suggested Topics

| |