Permanently delete not functioning

I’m on version 2.9.0.beta14 and I enabled permanently delete via DISCOURSE_CAN_PERMANENTLY_DELETE in app.yml.

The option comes up in the forum for a post and if I click it, it brings up a modal asking for me to confirm and then when I click OK nothing happens.

Looking in network tab in devtools there are no requests. Looking in console there are no additional error or logs.

The post is not deleted, it still remains.

1 Like

Update after 3.0.0 beta 15 it still does not function correctly. Anything I can do to provide logs etc? Thanks

Hi @Soenneker :slight_smile:

Sorry for the belated response. I’ve just enabled the setting and given it a run-through on my test site to check and I’m also seeing similar behaviour, but only if I don’t refresh the page before trying to perform the permanent delete.

My step-by-step:

  • Soft delete an existing post
  • Open post wrench and click ‘Permanently delete’
  • ‘Are you sure you permanently want to delete this post? You will not be able to recover it.’ confirm modal appears
  • Click on ‘Yes’
  • Modal closes, but no response. Post remains soft-deleted

However, if I add a page refresh it works as intended:

  • Soft delete an existing post
  • Refresh page
  • Reveal soft-deleted post using ‘View hidden reply’
  • Open post wrench and click ‘Permanently delete’
  • ‘Are you sure you permanently want to delete this post? You will not be able to recover it.’ confirm modal appears
  • Click on ‘Yes’
  • And the post is permanently deleted (as long as I’ve waited 5 minutes, or used a second test user with admin privileges)

Does this sound familiar, or could I try something else to replicate what you’re seeing?

4 Likes

Hi @JammyDodger

Thanks for your reply.

I see the issue you are talking about, all of this is lining up with current functionality that I’m seeing too.

A few things to add to the observations:

If I refresh on a soft deleted page after 5 minutes has passed, and I permanently delete the post, the topic is still not deleted. I get the modal that you’re seeing and I press OK. For posts other than the original post, it works.

However, if I go to /latest?status=deleted it still comes up in the list of topics. The topics show Replies -1, and if I click on these topics I then see “:frowning: error something went wrong” page.

I did receive a 500 error at one point, this looks like perhaps the topic was still deleting or something and perhaps I tried deleting it while it was in progress:
Looking at the error log this is what I see:

NoMethodError (undefined method `topic_id' for nil:NilClass)
lib/post_destroyer.rb:60:in `destroy'
app/controllers/topics_controller.rb:643:in `destroy'
app/controllers/application_controller.rb:413:in `block in with_resolved_locale'
app/controllers/application_controller.rb:413:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:368:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:209:in `call'
1 Like

Excellent. I think that’s just the info I needed for a repro. :slight_smile: :+1:

I’ve tried again, but with a topic that consists of only the OP:

  • Create topic (with no replies)
  • Soft-delete topic (and wait 5 minutes)
  • Open post wrench and select ‘Permanently delete’
  • Confirm
  • ‘Error. Something went wrong’
  • Topic still appears in ?status=deleted, but gives an ‘Error. Something went wrong’ screen when accessing and gives this message in the console:
TypeError: p is undefined
    setupController topic-from-params.js:68
    setup Ember
    s router_js.js:1514
    routeEnteredOrUpdated router_js.js:1524
    setupContexts router_js.js:1470
    finalizeTransition router_js.js:1378
    promise router_js.js:1321
    b rsvp.js:435
    g rsvp.js:421
    invoke queue.ts:203
    flush queue.ts:98
    flush deferred-action-queues.ts:75
    _end index.ts:616
    end index.ts:298
    _run index.ts:667
    run index.ts:339
    d Ember
    success ajax.js:101
    jQuery 6
    y ajax.js:150
    E rsvp.js:460
    E rsvp.js:916
    f ajax.js:163
    loadTopicView topic.js:24
    getAndRemove preload-store.js:28
    E rsvp.js:460
    E rsvp.js:916
    getAndRemove preload-store.js:27
    loadTopicView topic.js:24
    refresh post-stream.js:264
    model topic-from-params.js:25
    deserialize Ember
    getModel router_js.js:775
    resolve router_js.js:616
    b rsvp.js:435
    g rsvp.js:421
    invoke queue.ts:203
    flush queue.ts:98
    flush deferred-action-queues.ts:75
    _end index.ts:616
    _boundAutorunEnd index.ts:257
    promise callback*n/< platform.ts:28
    flush Ember
    _scheduleAutorun index.ts:803
    _ensureInstance index.ts:791
    schedule index.ts:384
    <anonymous> Ember
    v rsvp.js:492
    resolve router_js.js:934
    y router_js.js:249
    getTransitionByIntent router_js.js:1305
    transitionByIntent router_js.js:1247
    doTransition router_js.js:1366
    transitionTo router_js.js:1776
    Ember 2
    handleURL url.js:366
    routeTo url.js:211
    w topic-list-item.js:31
    click topic-list-item.js:187
    Ember 5
application.js:83

Let’s see if we can get that looked at. :+1: :slight_smile:

1 Like

I merged a few fixes related to permanently delete a few days ago. I think everything should work as expected now.

Thank you for the bug report!

2 Likes

This topic was automatically closed after 3 days. New replies are no longer allowed.