Cannot link to discourse using absolute paths without also including domain
-
Continuing the discussion from Statsporn - 2014-07-31:
yep....
/t/1000 wins again!
edit: huh that trailing slash is important.... good to know.
edit2: WTF? clicking the link gives permission denied, but entering http://what.thedailywtf.com/t/1000 works? they're the same darned link!
in short this doesn't work
[this](/t/1000)
edit: this doesn't work either....
but this does[this](what.thedailywtf.com/t/1000)
but this does
[this](http://what.thedailywtf.com/t/1000)
DISCOURSE!
-
-
-
repro for me:
-
Wait wtf.
Normal left-clicking gives me access denied as well. But middle-clicking as I initially did works no problem.
#Maybe Discourse should stop B*****ming around with links for stupid Jeff reasons
-
not to mention that my first attempt resulted in a bad link. apparently the protocol is also required.
-
I got a repro, if you attempt to open the first link in the same tab (left click), not in a new tab (middle/right click).
One thing I noticed, in the Access Denied, it says:
while trying to load /t/id_for/1000
It looks like it's assuming something wrong.
-
apparently the protocol is also required
That's been mentioned a few times in a few places, and even bug reported for a specific case.
-
yeah. i've seen that bug too, just forgot about it.
-
// If we're on the same site, use the router and track via AJAX
and
idForSlug: function(slug) { return Discourse.ajax("/t/id_for/" + slug); }
Which sends
X-Requested-With : XmlHttpRequest
. To which Discourse responds: fuck you, you ain't writing an API.
-
hmmm which image meme is right for this?
facepalm or cluebat?
-
-
must... find (or make).... that.... imagememe
-
So, in testing:
[link](/1000) Doesn't work [link](/t/1000) Doesn't work [link](/t/something/1000) Does work
I kinda expected the first to not work, but it was worth a try.
-
-
link Doesn't work
link Doesn't work
link Does workGET /404-body?_=... HTTP/1.1
GET /t/id_for/1000?_=... HTTP/1.1
withX-Requested-With : XmlHttpRequest
GET /t/1000.json?slug=something&id=1000&track_visit=true&_=... HTTP/1.1
This API I've been planing to make is going to be a fucking hell.
-
-
if you click the /t/id_for/1000 link from there it does work
Yep, since it's not sending the header.
This API I've been planing to make is going to be a fucking hell.
Speaking of which... @accalia, how the hell do the
/topics/timings/
work?
-
line 223 of
SockBot/discourse.js
function readPosts(topic_id, posts, callback) { if (typeof posts === 'number') { posts = [posts]; } if (!Array.isArray(posts)) { return callback(true); } var form = { 'topic_id': topic_id, 'topic_time': 4242 * Math.ceil(posts.length / 3) }; posts.forEach(function (post) { form['timings[' + post + ']'] = 4242; }); postContent('topics/timings', form, callback); } exports.readPosts = readPosts;
post the topic id, how long you've been reading the topic (in ms. sockbot does 4 seconds 242 ms), and a list of the post_number's and how long you spent on each post.
//TODO: actually document what the flagnar SockBot does under the covers
-
post the topic id, how long you've been reading the topic (in ms. sockbot does 4 seconds 242 ms), and a list of the post_number's and how long you spent on each post.
Hm, yeah, that makes sense. Though it seems like that won't work when last timings request wasn't in the last 100 seconds...
def update_time_read! if last_seen = last_seen_cached diff = (Time.now.to_f - last_seen.to_f).round if diff > 0 && diff < MAX_TIME_READ_DIFF //!!! UserStat.where(user_id: id, time_read: time_read).update_all ["time_read = time_read + ?", diff] end end cache_last_seen(Time.now.to_f) end
-
hmm... maybe something weird is going on there then. because the reads do get registered.
@zoidberg made it to TL1 without my intervention at all and i'm fairly sure should be making TL2 in the next week or so. and i've never sockpuppeted him through the web. only via PM.
and @pjh has confirmed that i'm solidly at the top, or very close to it for number of posts read ever, thanks to my cyborg side that makes sure any post older than 3 days gets read automatically.
-
It's good cholesterol, but it spreads like bad cholesterol.
-
and @pjh has confirmed that i'm solidly at the top, or very close to it for number of posts read ever, thanks to my cyborg side that makes sure any post older than 3 days gets read automatically.
[postgres@sofa ~]$ sql_tdwtf posts_days # Posts read and days visited SELECT row_number() OVER (ORDER BY sum(posts_read) DESC) as n, sum(posts_read) as "Posts read", count(*) as "Days visited", u.username as "User id" FROM user_visits v JOIN users u on u.id = v.user_id GROUP BY u.username ORDER BY sum(posts_read) DESC LIMIT 25 n | Posts read | Days visited | User id ----+------------+--------------+----------------- 1 | 147230 | 69 | accalia 2 | 125397 | 128 | VinDuv 3 | 121844 | 159 | PJH 4 | 117822 | 156 | Keith 5 | 116740 | 157 | dkf 6 | 116170 | 151 | Maciejasjmj 7 | 115599 | 160 | ben_lubar 8 | 115468 | 157 | ChaosTheEternal 9 | 110785 | 20 | ben_lubot 10 | 110352 | 144 | darkmatter 11 | 109757 | 120 | Yamikuronue 12 | 108724 | 134 | Arantor 13 | 107410 | 160 | blakeyrat 14 | 106397 | 97 | Spencer 15 | 105656 | 39 | sockbot 16 | 103288 | 140 | mott555 17 | 103283 | 146 | loopback0 18 | 102967 | 116 | aliceif 19 | 101558 | 151 | Luhmann 20 | 100865 | 151 | boomzilla 21 | 99187 | 131 | cartman82 22 | 98087 | 144 | antiquarian 23 | 97317 | 138 | Jaloopa 24 | 97279 | 137 | HardwareGeek 25 | 95486 | 67 | tarunik (25 rows) Elapsed: 0.043s Backup taken: 2014-10-25 11:45:01.975865
Caveat: That total includes things like PMs.
-
That's total days visited rather than consecutive isn't it? How close am I to my 100% badge?
-
[postgres@sofa ~]$ NAME=Jaloopa sql_tdwtf attendance # Record of continuous days of attendance # Most continuous days of attendance WITH StartingPoints AS ( SELECT user_id, visited_at, ROW_NUMBER() OVER(ORDER BY user_id, visited_at) AS rownum FROM user_visits AS A WHERE NOT EXISTS ( SELECT * FROM user_visits AS B WHERE B.visited_at = A.visited_at - 1 AND B.user_id = A.user_id ) ), EndingPoints AS ( SELECT user_id, visited_at, ROW_NUMBER() OVER(ORDER BY user_id, visited_at) AS rownum FROM user_visits AS A WHERE NOT EXISTS ( SELECT * FROM user_visits AS B WHERE B.visited_at = A.visited_at + 1 AND B.user_id = A.user_id ) ) SELECT u.username, S.visited_at AS start_range, E.visited_at AS end_range, (E.visited_at - S.visited_at +1) AS Days FROM StartingPoints AS S JOIN EndingPoints AS E ON E.rownum = S.rownum JOIN users u ON u.id=S.user_id AND u.username like 'Jaloopa' username | start_range | end_range | days ----------+-------------+------------+------ Jaloopa | 2014-05-21 | 2014-06-07 | 18 Jaloopa | 2014-06-09 | 2014-06-21 | 13 Jaloopa | 2014-06-23 | 2014-06-27 | 5 Jaloopa | 2014-06-29 | 2014-07-05 | 7 Jaloopa | 2014-07-07 | 2014-07-11 | 5 Jaloopa | 2014-07-18 | 2014-07-18 | 1 Jaloopa | 2014-07-21 | 2014-07-22 | 2 Jaloopa | 2014-07-24 | 2014-07-25 | 2 Jaloopa | 2014-07-28 | 2014-08-02 | 6 Jaloopa | 2014-08-04 | 2014-08-08 | 5 Jaloopa | 2014-08-11 | 2014-08-24 | 14 Jaloopa | 2014-08-26 | 2014-09-06 | 12 Jaloopa | 2014-09-08 | 2014-10-25 | 48 (13 rows) Elapsed: 0.255s Backup taken: 2014-10-25 11:45:01.975865
-
Still a while to go then. Thanks.
-
he he he.... i've visited 69 days of the last one hundred.....
-snicker-
i really shouldn't find that as amusing as i do. maybe it's having to wake up at 4AM and forgetting so i'm only operating on 3 hours or so of sleep? or maybe my humor is really just that sophmoric.
-
he he he.... i've visited 69 days in a row.....
No. You haven't...
[postgres@sofa ~]$ NAME=accalia sql_tdwtf attendance # Record of continuous days of attendance # Most continuous days of attendance WITH StartingPoints AS ( SELECT user_id, visited_at, ROW_NUMBER() OVER(ORDER BY user_id, visited_at) AS rownum FROM user_visits AS A WHERE NOT EXISTS ( SELECT * FROM user_visits AS B WHERE B.visited_at = A.visited_at - 1 AND B.user_id = A.user_id ) ), EndingPoints AS ( SELECT user_id, visited_at, ROW_NUMBER() OVER(ORDER BY user_id, visited_at) AS rownum FROM user_visits AS A WHERE NOT EXISTS ( SELECT * FROM user_visits AS B WHERE B.visited_at = A.visited_at + 1 AND B.user_id = A.user_id ) ) SELECT u.username, S.visited_at AS start_range, E.visited_at AS end_range, (E.visited_at - S.visited_at +1) AS Days FROM StartingPoints AS S JOIN EndingPoints AS E ON E.rownum = S.rownum JOIN users u ON u.id=S.user_id AND u.username like 'accalia' username | start_range | end_range | days ----------+-------------+------------+------ accalia | 2014-05-30 | 2014-05-30 | 1 accalia | 2014-06-04 | 2014-06-05 | 2 accalia | 2014-06-17 | 2014-06-18 | 2 accalia | 2014-08-23 | 2014-10-25 | 64 (4 rows) Elapsed: 0.257s Backup taken: 2014-10-25 11:45:01.975865
-
that may be true, but that's not why i was laughing like a pre-teen laughing at a naughty joke.
-
that may be true, but that's not why i was laughing like a pre-teen laughing at a naughty joke.
Facts are barriers to jokes.
-
you're telling me!
-
As you can see "/t/1000" match the topicBySlug resource (on the client side internal routing).
When you hit the server directly. The initial routing logic is done server side. which has an extra logic.
and that is why the direct link worked.
-
n | Posts read | Days visited | User id
----+------------+--------------+-----------------
1 | 147230 | 69 | accaliaSomething screwy there. The about page says 132K total posts.
-
hmm true. and i've not read almost 10k PMs
@pjh, do you know where those missing posts came from/went to?
-
The posts_read field probably contains overlaps on actual posts read.
-
No idea, which is why I wanted to join it to badge_posts or similar for the 3^n series, but the query was taking too long...
-
I feel better at least knowing that I haven't missed thousands of WTFs. Hmm...maybe time to deploy the reader on that thread daily to game the posts read count...
-
Nah man, what you want to game is the posts read time. @accalia has 13 days of read time, you'll need to beat that.
-
well then...... how high should i crank that number?
3 years? 10?
cause i can do that!
-
Nah man, what you want to game is the posts read time. @accalia has 13 days of read time, you'll need to beat that.
I think one accomplishes the other. But seriously...where did you get the 13 days of read time stat? I wouldn't be even a little surprised if I had more read time than @accalia.
-
I'm assuming off the topic timings. and if so i really can crank that as high as i want to by making my reader module read all posts not just unread ones, and giving the time per post value a ridiculously high number.
-
I'm assuming off the topic timings.
Yes, I'm just wondering where @riking saw that, because I don't recall seeing @PJH post that.
-
Yes, I'm just wondering where @riking saw that, because I don't recall seeing @PJH post that.
I haven't. And accalia isn't even in the top 3 for read time (as of last-night's ~midnight UTC backup.)
-
I haven't. And aliceif isn't even in the top 3 for read time (as of last-night's ~midnight UTC backup.)
That's not surprising, but @riking was talking about @accalia. But now that you've brought it up...
-
Just trying to find out how to format 7 digit numbers into days, hours and minutes...
-
Could just post it in terms of days with a decimal at the end. That's simple division.
-
Yes, I'm just wondering where @riking saw that, because I don't recall seeing @PJH post that.
it's probably in /admin somwhere.
-
it's probably in /admin somwhere.
Could just post it in terms of days with a decimal at the end. That's simple division.
[postgres@sofa ~]$ sql_tdwtf time_read SELECT u.username, (time_read /86400 || ' days') || ' ' || TO_CHAR((time_read % 86400 || ' second')::interval, 'HH24:MI:SS') AS duration FROM user_stats us JOIN users u ON u.id=us.user_id ORDER BY time_read DESC LIMIT 25 username | duration -----------------+------------------ HardwareGeek | 28 days 04:51:56 ChaosTheEternal | 27 days 07:02:10 PJH | 23 days 09:40:24 boomzilla | 20 days 15:46:17 aliceif | 19 days 17:45:37 ben_lubar | 16 days 22:27:15 Luhmann | 16 days 21:06:04 Onyx | 16 days 07:52:28 Arantor | 16 days 06:16:00 abarker | 16 days 05:37:31 faoileag | 14 days 17:40:01 Maciejasjmj | 14 days 11:29:28 cartman82 | 14 days 09:34:25 Keith | 14 days 05:16:52 dkf | 14 days 03:28:55 blakeyrat | 13 days 18:54:00 darkmatter | 13 days 15:24:54 accalia | 13 days 02:27:41 Zecc | 13 days 01:04:15 antiquarian | 12 days 01:04:01 Matches | 11 days 19:21:03 VinDuv | 11 days 07:47:35 loopback0 | 10 days 12:45:37 locallunatic | 10 days 12:38:35 reverendryan | 10 days 08:41:02 (25 rows)
-
19 days well spent!
-
Note that the table being queried isn't primary data - that is, I think, the massive post_timings table.