Strange topic won't display

So in my /latest I have an entry of the following:

However, if I try to read it, I only see a blank page with the title in the top bar if I make the browser size small enough and “scroll” up:

If I use the magic undocumented /raw/ URL, I get the “The page you requested doesn’t exist or is private.” message. Also note above, the value of Replies is -1.

This happens with or without customizations enabled.

Any ideas? The actual post is at:

https://talk.openmrs.org/t/are-we-being-excessive-in-not-allowing-re-saving-of-orderfrequency-once-its-in-use/1946

1 Like

One more thing, this topic was created by email … not sure if that makes a difference.

Anything in /logs about this? It looks like the topic was somehow invalid.

There’s also an error in the JS console if you use f12 to view it.

TypeError: Cannot read property 'get' of undefined
    at eval (eval at <anonymous> (https://talk.openmrs.org/assets/application-d84f137dac5e576f8099b899bd60d681.js:1:256144), <anonymous>:37:36)
    at tryCatch (eval at <anonymous> (https://talk.openmrs.org/assets/vendor-6bf32a916dad1985b0362055d3458364.js:1:427441), <anonymous>:44875:16)
    at invokeCallback (eval at <anonymous> (https://talk.openmrs.org/assets/vendor-6bf32a916dad1985b0362055d3458364.js:1:427441), <anonymous>:44887:17)
    at publish (eval at <anonymous> (https://talk.openmrs.org/assets/vendor-6bf32a916dad1985b0362055d3458364.js:1:427441), <anonymous>:44858:11)
    at eval (eval at <anonymous> (https://talk.openmrs.org/assets/vendor-6bf32a916dad1985b0362055d3458364.js:1:427441), <anonymous>:26584:7)
    at Queue.invoke (eval at <anonymous> (https://talk.openmrs.org/assets/vendor-6bf32a916dad1985b0362055d3458364.js:1:427441), <anonymous>:872:18)
    at Object.Queue.flush (eval at <anonymous> (https://talk.openmrs.org/assets/vendor-6bf32a916dad1985b0362055d3458364.js:1:427441), <anonymous>:937:13)
    at Object.DeferredActionQueues.flush (eval at <anonymous> (https://talk.openmrs.org/assets/vendor-6bf32a916dad1985b0362055d3458364.js:1:427441), <anonymous>:742:19)
    at Object.Backburner.end (eval at <anonymous> (https://talk.openmrs.org/assets/vendor-6bf32a916dad1985b0362055d3458364.js:1:427441), <anonymous>:167:27)
    at Object.Backburner.run (eval at <anonymous> (https://talk.openmrs.org/assets/vendor-6bf32a916dad1985b0362055d3458364.js:1:427441), <anonymous>:222:20)

Nope, the only thing at all is an unrelated ActionView::Template::Error about /latest.rss.

I re-created the topic from the original email – is there any easy way to just delete the topic somehow without being able to access the wrench menu? DB?

If you have the ID, then

# ssh into server
cd /var/discourse
./launcher enter app
rails c
t = Topic.find(<id>)
PostDestroyer.new(Discourse.system_user, t.posts.first).destroy

should be enough.

1 Like

Just to confirm, when you say ID, you’re saying the integer like 29123 is for this topic?

Exactly. I meant the “topic id”.

1 Like

Oops, no luck:

[2] pry(main)> t = Topic.find(1946)
=> #<Topic id: 1946, title: "Are we being excessive in not allowing re-saving o...", last_posted_at: nil, created_at: "2015-05-22 00:50:51", updated_at: "2015-05-22 00:50:51", views: 24, posts_count: 0, user_id: 81, last_post_user_id: 81, reply_count: 0, featured_user1_id: nil, featured_user2_id: nil, featured_user3_id: nil, avg_time: nil, deleted_at: nil, highest_post_number: 0, image_url: nil, off_topic_count: 0, like_count: 0, incoming_link_count: 0, bookmark_count: 0, category_id: 8, visible: true, moderator_posts_count: 0, closed: false, archived: false, bumped_at: "2015-05-22 00:50:51", has_summary: false, vote_count: 0, archetype: "regular", featured_user4_id: nil, notify_moderators_count: 0, spam_count: 0, illegal_count: 0, inappropriate_count: 0, pinned_at: nil, score: nil, percent_rank: 0.0, notify_user_count: 0, subtype: nil, slug: "are-we-being-excessive-in-not-allowing-re-saving-o...", auto_close_at: nil, auto_close_user_id: nil, auto_close_started_at: nil, deleted_by_id: nil, participant_count: 1, word_count: nil, excerpt: nil, pinned_globally: false, auto_close_based_on_last_post: false, auto_close_hours: nil>

[3] pry(main)> PostDestroyer.new(Discourse.system_user, t.posts.first).destroy
NoMethodError: undefined method `trash!' for nil:NilClass
from /var/www/discourse/lib/post_destroyer.rb:73:in `block in perform_delete'

Ok, try the nuclear option: Topic.find(<id>).destroy

:boom:

That worked. Thanks. :slight_smile:

1 Like

… which implies that the problem was that the topic had no first post.

1 Like

Indeed, but the real mystery is why?

1 Like