Can't Delete old topics

I’m using helm to deploy the bitnami discourse image on a server, and I’m mostly using the API to interact with it. I’m running into the following issue:

A user is able to create a topic and then delete the topic soon after creating it. But if a week or so passes by, that same user gets an error when trying to delete a post. Looking at the logs, I see

Started DELETE “/t/124” for 162.220.157.139 at 2022-06-20 19:41:43 +0000
Mon, Jun 20 2022 2:41:43 pm Processing by TopicsController#destroy as JSON
Mon, Jun 20 2022 2:41:43 pm Parameters: {“id”=>“124”, “topic”=>{}}
Mon, Jun 20 2022 2:41:43 pm Can’t verify CSRF token authenticity.
Mon, Jun 20 2022 2:41:43 pm Completed 422 Unprocessable Entity in 29ms (Views: 0.2ms ActiveRecord: 0.0ms Allocations: 2357)

This is the log of a successful delete:

Started DELETE “/t/135” for 162.220.157.139 at 2022-06-20 21:37:07 +0000
Mon, Jun 20 2022 4:37:08 pm Processing by TopicsController#destroy as JSON
Mon, Jun 20 2022 4:37:08 pm Parameters: {“id”=>“135”, “topic”=>{}}
Mon, Jun 20 2022 4:37:08 pm Can’t verify CSRF token authenticity.
Mon, Jun 20 2022 4:37:08 pm Rendered text template (Duration: 0.0ms Allocations: 1)
Mon, Jun 20 2022 4:37:08 pm Completed 200 OK in 301ms (Views: 1.4ms ActiveRecord: 0.0ms Allocations: 11569)

Even on the actual UI, trying to delete an older message gives me:

You don’t have permission to delete this topic. If you really want it to be deleted, submit a flag for moderator attention together with reasoning.

Any idea why a user would not be able to delete their own topic after some time has passed?

Also, oidc auth is being used to log in. (Keycloak)

There’s a setting. Search site settings for delete and your should find it.

A user can delete their topic as long as it has no replies, otherwise they’ll hit that error. It’s to prevent them deleting other people’s content without staff knowledge/approval.

1 Like

I think that’s it. I was thinking that there was a delete window like post edit time limit.

I’ve scoured the settings and changed all that might apply to posts, topics, and deleting/removing, but none have had any effect.

The posts the user is trying to delete do not have any replies, but are over a week old. The user was just able to delete a post that was 16 hours old, and will test a 24 hours old one later today.

Here’s the user and a topic they can’t delete:

{
  user: {
    id: 20,
    username: 'molenchuk-tite-99ecd',
    name: 'teacher firstgrade',
    avatar_template: '/letter_avatar_proxy/v4/letter/m/cab0a1/{size}.png',
    email: 'molenchuk+titeacher@weare5stones.com',
    secondary_emails: [],
    active: true,
    admin: false,
    moderator: false,
    last_seen_at: '2022-06-20T21:49:19.750Z',
    last_emailed_at: null,
    created_at: '2022-06-13T16:33:29.655Z',
    last_seen_age: 60354.179525574,
    last_emailed_age: null,
    created_at_age: 684104.274168186,
    trust_level: 1,
    manual_locked_trust_level: null,
    flag_level: 0,
    title: null,
    time_read: 168,
    staged: false,
    days_visited: 1,
    posts_read_count: 6,
    topics_entered: 1,
    post_count: 0
  },
  topic: {
    post_stream: { 
      posts: [
        {
          id: 127,
          name: 'teacher firstgrade',
          username: 'molenchuk-tite-99ecd',
          avatar_template: '/letter_avatar_proxy/v4/letter/m/cab0a1/{size}.png',
          created_at: '2022-06-13T16:36:45.485Z',
          cooked: '<p>This message is to confirm the system is working now.</p>',
          post_number: 1,
          post_type: 1,
          updated_at: '2022-06-13T16:36:45.485Z',
          reply_count: 0,
          reply_to_post_number: null,
          quote_count: 0,
          incoming_link_count: 0,
          reads: 2,
          readers_count: 1,
          score: 0.2,
          yours: false,
          topic_id: 124,
          topic_slug: 'confirmation-data',
          display_username: 'teacher firstgrade',
          primary_group_name: null,
          primary_group_flair_url: null,
          primary_group_flair_bg_color: null,
          primary_group_flair_color: null,
          version: 1,
          can_edit: true,
          can_delete: false,
          can_recover: false,
          can_wiki: true,
          read: false,
          user_title: null,
          bookmarked: false,
          actions_summary: [
            { id: 2, can_act: true },
            { id: 3, can_act: true },
            { id: 4, can_act: true },
            { id: 8, can_act: true },
            { id: 6, can_act: true },
            { id: 7, can_act: true }
          ],
          moderator: false,
          admin: false,
          staff: false,
          user_id: 20,
          hidden: false,
          trust_level: 1,
          deleted_at: null,
          user_deleted: false,
          edit_reason: null,
          can_view_edit_history: true,
          wiki: false,
          reviewable_id: 0,
          reviewable_score_count: 0,
          reviewable_score_pending_count: 0
        }
      ],
      stream: [ 127 ]
    },
    timeline_lookup: [ [ 1, 7 ] ],
    suggested_topics: [ [Object], [Object], [Object], [Object], [Object] ],
    id: 124,
    title: 'Confirmation Data',
    fancy_title: 'Confirmation Data',
    posts_count: 1,
    created_at: '2022-06-13T16:36:45.265Z',
    views: 9,
    reply_count: 0,
    like_count: 0,
    last_posted_at: '2022-06-13T16:36:45.485Z',
    visible: true,
    closed: false,
    archived: false,
    has_summary: false,
    archetype: 'regular',
    slug: 'confirmation-data',
    category_id: 22,
    word_count: 12,
    deleted_at: null,
    user_id: 20,
    featured_link: null,
    pinned_globally: false,
    pinned_at: null,
    pinned_until: null,
    image_url: null,
    slow_mode_seconds: 0,
    draft: null,
    draft_key: 'topic_124',
    draft_sequence: 0,
    unpinned: null,
    pinned: false,
    current_post_number: 1,
    highest_post_number: 1,
    deleted_by: null,
    has_deleted: false,
    actions_summary: [
      { id: 4, count: 0, hidden: false, can_act: true },
      { id: 8, count: 0, hidden: false, can_act: true },
      { id: 7, count: 0, hidden: false, can_act: true }
    ],
    chunk_size: 20,
    bookmarked: false,
    topic_timer: null,
    message_bus_last_id: 0,
    participant_count: 1,
    show_read_indicator: false,
    thumbnails: null,
    details: {
      can_edit: true,
      notification_level: 1,
      can_move_posts: true,
      can_delete: true,
      can_remove_allowed_users: true,
      can_invite_to: true,
      can_create_post: true,
      can_reply_as_new_topic: true,
      can_flag_topic: true,
      can_convert_topic: true,
      can_review_topic: true,
      can_close_topic: true,
      can_archive_topic: true,
      can_split_merge_topic: true,
      can_edit_staff_notes: true,
      can_toggle_topic_visibility: true,
      can_pin_unpin_topic: true,
      can_moderate_category: true,
      can_remove_self_id: 1,
      participants: [
        {
          id: 20,
          username: 'molenchuk-tite-99ecd',
          name: 'teacher firstgrade',
          avatar_template: '/letter_avatar_proxy/v4/letter/m/cab0a1/{size}.png',
          post_count: 1,
          primary_group_name: null,
          primary_group_flair_url: null,
          primary_group_flair_color: null,
          primary_group_flair_bg_color: null,
          trust_level: 1
        }
      ],
      created_by: {
        id: 20,
        username: 'molenchuk-tite-99ecd',
        name: 'teacher firstgrade',
        avatar_template: '/letter_avatar_proxy/v4/letter/m/cab0a1/{size}.png'
      },
      last_poster: {
        id: 20,
        username: 'molenchuk-tite-99ecd',
        name: 'teacher firstgrade',
        avatar_template: '/letter_avatar_proxy/v4/letter/m/cab0a1/{size}.png'
      }
    }
  }
}

Can you delete it from the UX?

Can’t delete it from the UX either

And what is the message there? (Then you can find the place in the code that references that error)

This is the message I get

This reminds me of the edit limits.

I think since the text in the post is changed, when you delete it, this limit affects deletions too.

I remember this topic where the edit also caused trouble

1 Like

That must be what I was looking for!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.