Discussion of NodeBB Updates
-
@Onyx It seemed to be killing everything every few minutes. I think it has a bug, because there were a lot of lines in the log from
complainBITCHing about it.
-
@boomzilla said in Discussion of NodeBB Updates:
@Onyx It seemed to be killing everything every few minutes. I think it has a bug, because there were a lot of lines in the log from
complainBITCHing about it.I had misspelled CLK_TCK as CLK_TICK and that was causing the threshold to be an empty string.
0 - 0 <
is apparently false, so it was killing PID 1, which restarts the docker container.
-
-
@Onyx said in Discussion of NodeBB Updates:
@ben_lubar said in Discussion of NodeBB Updates:
it was killing PID 1
...
that image meme looks familliar....... is that one of mine?
-
@accalia great biochemical processing systems tend to produce convergent results.
-
@Onyx said in Discussion of NodeBB Updates:
@accalia great biochemical processing systems tend to produce convergent results.
touche.
-
@ben_lubar said in NodeBB Updates:
DID SOMEONE SAY THEY WANTED THE SEARCH THING OR WHATEVER ALSO WHO STOLE MY NOT-SHIFT KEY
Dunno, did they delete their post yet?
-
@boomzilla said in Discussion of NodeBB Updates:
It seemed to be killing everything every few minutes.
So it's a "watch dog" in the same way that a starved, rabid pitbull in an orphanage is one?
-
@Lorne-Kates said in Discussion of NodeBB Updates:
@boomzilla said in Discussion of NodeBB Updates:
It seemed to be killing everything every few minutes.
So it's a "watch dog" in the same way that a starved, rabid pitbull in an orphanage is one?
It might be the first script with Munchausen by proxy.
-
@Maciejasjmj said in Discussion of NodeBB Updates:
It might be the first script with Munchausen by proxy.
This is IT ... never assume you are the first to do something stupid
-
@ben_lubar said in NodeBB Updates:
DID SOMEONE SAY THEY WANTED THE SEARCH THING OR WHATEVER ALSO WHO STOLE MY NOT-SHIFT KEY
Ben, your a piss of shit.
Just kiddin'.
-
@Lorne-Kates said in Discussion of NodeBB Updates:
So it's a "watch dog" in the same way that a starved, rabid pitbull in an orphanage is one?
Bash felt like it was really being abused and flagged it for LIBEL.
-
Status: currently downloading a fresh backup so I can run the following query on it:
db.objects.aggregate([{ $match: { _key: 'topics:tid' } }, { $project: { _id: 0, topicKey: { $concat: ['topic:', '$value'] }, repliesKey: { $concat: ['tid:', '$value', ':posts'] } } }, { $lookup: { from: 'objects', localField: 'topicKey', foreignField: '_key', as: 'topic' } }, { $lookup: { from: 'objects', localField: 'repliesKey', foreignField: '_key', as: 'replies' } }, { $project: { tid: '$topic[0].tid', postcount: '$topic[0].postcount', url: { $concat: ['https://what.thedailywtf.com/topic/', '$topic[0].slug'] }, expected: { $add: [{ $size: '$replies' }, { $cond: { if: { $gt: ['$topic[0].mainPid', 0] }, then: 1, else: 0 } }] } } }, { $match: { postcount: { $ne: '$expected' } } }])
-
@ben_lubar Status:
2016-11-20T22:55:45.720+0000 [##############..........] 0.objects 3.3 GB/5.3 GB (62.1%)
-
@ben_lubar said in Discussion of NodeBB Updates:
@ben_lubar Status:
2016-11-20T22:55:45.720+0000 [##############..........] 0.objects 3.3 GB/5.3 GB (62.1%)
Status: looks like about 1% per minute.
2016-11-20T23:10:45.720+0000 [##################......] 0.objects 4.1 GB/5.3 GB (77.3%)
Edit: also, there's the index building, so I still won't be able to run the query when this progress bar fills up.
-
Status: ok, revised query:
db.objects.aggregate([{ $match: { _key: 'topics:tid' } }, { $project: { _id: 0, topicKey: { $concat: ['topic:', '$value'] }, repliesKey: { $concat: ['tid:', '$value', ':posts'] } } }, { $lookup: { from: 'objects', localField: 'topicKey', foreignField: '_key', as: 'topic' } }, { $lookup: { from: 'objects', localField: 'repliesKey', foreignField: '_key', as: 'replies' } }, { $project: { topic: { $arrayElemAt: ['$topic', 0] }, expected: { $size: '$replies' } } }, { $project: { topic: '$topic', expected: { $add: ['$expected', { $cond: { if: { $gt: ['$topic.mainPid', 0] }, then: 1, else: 0 } }] } } }, { $project: { tid: '$topic.tid', url: { $concat: ['https://what.thedailywtf.com/topic/', '$topic.slug'] }, postcount: '$topic.postcount', expected: '$expected', problem: { $ne: ['$topic.postcount', '$expected'] } } }, { $match: { problem: true } }])
Result:
[ { "expected" : 104, "tid" : 21152, "url" : "https://what.thedailywtf.com/topic/21152/testing-candidate-s-mettle-s02e04", "postcount" : 105, "problem" : true }, { "expected" : 1, "tid" : 21056, "url" : "https://what.thedailywtf.com/topic/21056/micro-and-macro-in-purple", "postcount" : 0, "problem" : true }, { "expected" : 3, "tid" : 21055, "url" : "https://what.thedailywtf.com/topic/21055/micro-and-macro-in-purple", "postcount" : 2, "problem" : true }, { "expected" : 58360, "tid" : 12236, "url" : "https://what.thedailywtf.com/topic/12236/the-official-status-thread", "postcount" : 58362, "problem" : true } ]
-
Does anyone have the userscript that adds the view raw and reply as new topic buttons? I'd like to add that to our customizations plugin.
-
@ben_lubar said in Discussion of NodeBB Updates:
Does anyone have the userscript that adds the view raw and reply as new topic buttons?
I think those are @anotherusername's.
-
@boomzilla yeah, it's mine... I've kept building onto the function that processes every post to inject those so it also does some other stuff, so lemme snip out the relevant parts...
-
// add "view raw" and "reply as topic" options to posts function processPosts() { // this function actually creates the element and requests the raw content to display function addRaw(pid, post, vis) { var raw = document.createElement('div'); raw.setAttribute('class', 'content raw-content loading hidden'); post.parentElement.insertBefore(raw, post); socket.emit('posts.getRawPost', pid, function (err, rawContent) { raw.classList.remove('loading'); if (err) { console.error(err); raw.parentElement.removeChild(raw); } else { raw.innerText = rawContent; if (vis) { raw.classList.remove('hidden'); post.classList.add('hidden'); } // this mutation observer will watch the post for deletion / edits var o = new MutationObserver(function () { var li = post.parentElement, raw = li.querySelector(".raw-content"); if (li.classList.contains("deleted")) { o.disconnect(); } else if (!raw || raw.classList.contains("hidden")) { li.contains(raw) && li.removeChild(raw); o.disconnect(); } else { // post was edited, update raw content socket.emit('posts.getRawPost', pid, function (err, rawContent) { if (err) { o.disconnect(); console.error(err); } else { raw.innerText = rawContent; } }); } }); o.observe(post, {childList: true, characterData: true, subtree: true}); } }); } // if the raw exists, this just toggles between it and the baked post // otherwise, it'll call addRaw to do the heavy lifting function showRaw() { for (var e = this; e.getAttribute("component") != "post"; e = e.parentElement); var post = e.querySelector(".content:not(.raw-content)"), raw = e.querySelector(".content.raw-content"); var pid = e.getAttribute("data-pid"); if (raw) { if (!raw.classList.contains('loading')) { if (post.classList.contains("hidden")) { raw.classList.add("hidden"); post.classList.remove("hidden"); } else { post.classList.add("hidden"); raw.classList.remove("hidden"); } } } else { addRaw(pid, post, true); } // this scrolls the page only if necessary to keep the "view raw" button within the viewport var t = document.getElementById("header-menu").getBoundingClientRect().bottom, b = window.innerHeight, r = this.getBoundingClientRect(); if (r.top < t) window.scrollBy(0, r.top - t); else if (r.bottom > b) window.scrollBy(0, r.bottom - b); } // this relies on the addRaw function from above, and it quotes the entire post, regardless of any selected text // by default, the new topic will be titled "Re: (original title)" and in the same category as the original function replyAsTopic() { var e = this.closest('li[component="post"]'), pid = e.getAttribute('data-pid'); // start a new topic composer, with the same category as the quoted post's topic selected by default window.app.newTopic(window.ajaxify.data.cid); // this watches the post so it'll fire when addRaw has finished var o = new MutationObserver(function () { var raw = e.querySelector('.raw-content'); if (raw) { o.disconnect(); // I can't add a quote to the composer until after it's finished loading // as far as I know, there's no event or callback when the composer finishes loading // a mutation observer would need to watch the whole page, so I'm just going to use an interval var i = setInterval(function () { try { var t = document.querySelector('.composer input.title'); if (t) { clearInterval(i); // set the title of the new topic t.value = "Re: " + window.ajaxify.data.title; // grab the raw post out of the element that addRaw created var r = e.querySelector('.raw-content'), h = r.classList.contains('hidden'); r.classList.remove('hidden'); var raw = r.innerText; r.classList.toggle('hidden', h); // add the quote to the composer $(window).trigger('action:composer.addQuote', { tid: ajaxify.data.tid, slug: ajaxify.data.slug, index: e.getAttribute('data-index'), pid: e.getAttribute('data-pid'), topicName: ajaxify.data.titleRaw, username: '@' + e.getAttribute('data-username'), text: raw }); setTimeout(function () { document.querySelector('.composer textarea.write').focus(); }, 100); } } catch (e) { console.error(e); clearInterval(i); } }, 100); } }); o.observe(e, {childList: true, subtree: true}); // if the raw element doesn't exist, call addRaw to add it; otherwise, just force the observer to fire if (!e.querySelector('.raw-content')) addRaw(pid, e.querySelector('.content')); else e.appendChild(e.lastChild); } for (var e of document.querySelectorAll('.post-tools')) { // add the "view raw" button if (!e.querySelector(".view-raw")) { var viewRawButton = document.createElement("a"); viewRawButton.appendChild(document.createTextNode("View Raw")); viewRawButton.setAttribute("class", "view-raw no-select"); viewRawButton.setAttribute("href", "#"); e.insertBefore(viewRawButton, e.firstChild); viewRawButton.addEventListener("click", showRaw); } // add the "reply as topic" item and a separator to the hamburger menu e = e.closest('.post-footer'); if (e.querySelector('.dropdown.open') && !e.querySelector('.reply-as-topic')) { // if there's a "Bookmark" option, this adds it right before that; otherwise, at the very top var favOption = e.querySelector('[component="post/bookmark"]') || e.querySelector('.dropdown-menu li'); if (favOption) { favOption = favOption.closest('li'); var option = favOption.parentElement.insertBefore(document.createElement('li'), favOption); option.setAttribute('role', 'presentation'); var a = option.appendChild(document.createElement('a')); a.appendChild(document.createTextNode('Reply as topic')); a.setAttribute('role', 'menuitem'); a.setAttribute('href', '#'); a.classList.add('reply-as-topic'); a.addEventListener('click', replyAsTopic); var divider = option.parentElement.insertBefore(document.createElement('li'), favOption); divider.setAttribute('role', 'presentation'); divider.classList.add('divider'); divider.style.display = "block"; } else { console.error("Unable to add \"Reply as topic\" item to post menu"); console.log(e); } } } } document.head.appendChild(document.createElement('style')).innerHTML = ".post-tools .view-raw{background-color:#337ab7;color:white;padding:10px;margin-right:3px}li.deleted .view-raw" + "{display:none}.raw-content{font-family:monospace;font-size:10pt;white-space:pre-wrap;margin-bottom:15px}"; new MutationObserver(processPosts).observe(document.body, {childList: true, subtree: true}); processPosts();
-
@anotherusername it'd be just a bit cleaner if
addRaw
was given a callback argument to call after it's done... then "reply as topic" wouldn't need to set a mutation observer to watch for it. And the mutation observer watchingdocument.body
could probably be replaced with events for NodeBB's new posts/thread loaded events, but I can never remember what those are off the top of my head.But it's good enough... the average WTF per LOC is pretty low, I think.
-
Ok so I posted the update notice an hour early because I don't want to stay up. I set it to take a backup before the update process starts, and I'm going to bed. Have fun with your view raw and your reply as new topic and your working timestamps, people of tomorrow!
Also, have fun with en-x-pirate, because en@pirate has been removed for having too many shift keys required to type it.
-
-
@ben_lubar said in Discussion of NodeBB Updates:
Ok so I posted the update notice an hour early because I don't want to stay up. I set it to take a backup before the update process starts, and I'm going to bed. Have fun with your view raw and your reply as new topic and your working timestamps, people of tomorrow!
Also, have fun with en-x-pirate, because en@pirate has been removed for having too many shift keys required to type it.
waits for forum to crash during update
-
Honey, I shrunk the Replies button!
http://i.imgur.com/QII6Z3i.png
Or maybe rather "squeezed it until it fit".
-
Looks much better in Polish (but then you have Polish on you).
-
And speaking of Polish:
-
@ben_lubar said in NodeBB Updates:
Highlights
You forgot the mention that the blue bar on low-width mode now has the thread title in it.
-
Also, mobile composer now actually unusable on IPad in landscape.
Is usable in portrait but, frankly, I hate iPad in portrait.
-
-
Anyway now that we have the necropost indicator, I've updated the old css (courtesy of @Maciejasjmj IIRC) to spongebob-ify it:
@font-face { font-family: sponge; src: url(/uploads/default/original/3X/8/e/8e076a5d6aa6f28e8a485f969fb06e63082f7a5e.ttf); } .necro-post { display: block; font-family: sponge; font-size: 72px; background-image: url(/uploads/default/original/3X/d/d/dd5fb009afd1f83bc662d69ba3ee43a0278d8663.png); color: #FFFFFF; text-align: center; margin-top: 0; }
-
@ben_lubar said in Discussion of NodeBB Updates:
Also, have fun with en-x-pirate, because en@pirate has been removed for having too many shift keys required to type it.
TIL that one press of Shift is too many
-
@Arantor that doesn't seem to be the mobile composer.
-
@ben_lubar It's hard to tell, since the font in the regular one is SO FREAKING HUGE NOW. Why? The font in posts is much smaller.
Also, am I the only one for whom the View Raw button screws with their reflexes? I got really used to "Reply" being the first on the left.
-
@Maciejasjmj said in Discussion of NodeBB Updates:
Also, am I the only one for whom the View Raw button screws with their reflexes? I got really used to "Reply" being the first on the left.
Yeah, and I know at least one @impossible-mission player made the same remark about the popcorn button.
-
@PleegWat said in Discussion of NodeBB Updates:
@Maciejasjmj said in Discussion of NodeBB Updates:
Also, am I the only one for whom the View Raw button screws with their reflexes? I got really used to "Reply" being the first on the left.
Yeah, and I know at least one @impossible-mission player made the same remark about the popcorn button.
It was on the right, though. They had me move it to the left.
-
@ben_lubar said in NodeBB Updates:
fixed some CSS anomalies
TypeError: document.querySelectorAll(...).forEach is not a function
https://what.thedailywtf.com/nodebb.min.js?3afd4c43b179
Line 10
-
-
@Maciejasjmj whaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaat
-
@ben_lubar said in NodeBB Updates:
- Added view raw and reply as new topic.
What would be extra-nice is if the label of the "raw" button changed when clicked (e.g. "view baked" or whatever jargon makes sense to you).
(hmmm, and not randomly crashing would be nice as well, but )
-
@ben_lubar it is whatever I get when I hit reply while on iPad in landscape mode.
I cannot see what I am typing.
-
@Arantor said in Discussion of NodeBB Updates:
@ben_lubar it is whatever I get when I hit reply while on iPad in landscape mode.
I cannot see what I am typing.
This is a workaround, not a fix, but if you hide the keyboard, is there a circle with an up-down arrow in it you can drag down?
-
-
@ChaosTheEternal said in Discussion of NodeBB Updates:
Ok, I think I can roll back the composer without losing any of the new features that work. Gonna test some more and also see if I can get the raw thing working on Firefox 22.
-
@ben_lubar said in Discussion of NodeBB Updates:
@ChaosTheEternal said in Discussion of NodeBB Updates:
Ok, I think I can roll back the composer without losing any of the new features that work. Gonna test some more and also see if I can get the raw thing working on Firefox 22.
Still getting perpetual .forEach is not a function, and the composed doesn't focus on Reply.
Presumably something in the past added .forEach to nodelists, but that's not there anymore? I see some bullshit in the minified that looks like it's trying to add .forEach
p.forEach = function(e, t, n, i) { for (var r = 0, o = -1; r = p.exec(e, t, r);) n.call(i, r, ++o, e, t), r = r.index + (r[0].length || 1); return i };
-
@remi said in Discussion of NodeBB Updates:
What would be extra-nice is if the label of the "raw" button changed when clicked (e.g. "view baked" or whatever jargon makes sense to you).
Or make it visually a toggle (so it still says raw, but is clearly 'active'). I'm not sure if node has a style for that though.
-
@PleegWat said in Discussion of NodeBB Updates:
@remi said in Discussion of NodeBB Updates:
What would be extra-nice is if the label of the "raw" button changed when clicked (e.g. "view baked" or whatever jargon makes sense to you).
Or make it visually a toggle (so it still says raw, but is clearly 'active'). I'm not sure if node has a style for that though.
Or make it an option in the ... menu so it stops fucking up everyone's muscle memory.
-
@PleegWat if the code is modified to toggle a class on the button, you could use a style like this:
.topic .post-tools .view-raw.depressed { box-shadow: inset 2px 2px 10px rgba(0,0,0,.8); position: relative; top: 2px; padding: 12px 8px 8px 12px; }
(Not sure how it'd work on dark themes... I guess you'd probably need to change the
box-shadow
color to white.)
-
-
@ben_lubar said in NodeBB Updates:
- Timestamps now use the correct incorrect format during a cold load.
Looks unchanged to me.