# PostRevisor لا يمكنه مراجعة المشاركات في المواضيع المحذوفة

**URL:** <https://meta.discourse.org/t/postrevisor-cant-revise-posts-in-deleted-topics/347130>\
**Category:** Bug\
**Created:** [14 يناير 2025، 8:36م UTC](https://meta.discourse.org/t/postrevisor-cant-revise-posts-in-deleted-topics/347130 "2025-01-14T20:36:53Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [15 يناير 2025، 5:05م UTC](https://meta.discourse.org/t/postrevisor-cant-revise-posts-in-deleted-topics/347130/11 "2025-01-15T17:05:37Z")

</div>

كان بحثي عن المنشورات يشبه `Post.where("raw like '%goo.gl%'"))، وهذا سيعيد المنشورات الموجودة في المواضيع المحذوفة. ثم يكون لهذه المنشورات `topic\_id`، لكن ليس لها موضوع. أعتقد أن هناك طريقة لجعل `Topic.find` يعيد المواضيع المحذوفة (لأن المدير يمكنه رؤية هذه المواضيع، وهذا هو سبب ارتباكي. أيقونة سلة المهملات الصغيرة سهلة الفوات).

لذا فهذا يشبه ما يلي:

```plaintext
deleted_topic = Topic.with_deleted.find_by(id: 123)

```

ربما كان يجب أن أفعل ذلك وأحدث المنشور قبل استدعاء `PostRevisor`؟

لكن في واجهة المستخدم، **يمكنني** تحديث منشور في موضوع محذوف، لذلك أفكر بأن

```plaintext
def initialize(post, topic = post.topic)
  @post = post
  @topic = topic
  # Make sure we have only one Topic instance
  post.topic = topic
end

```

يجب أن يكون

```plaintext
def initialize(post, topic = post.topic)
  @post = post
  @topic = topic || Topic.with_deleted.find_by(id: post_topic_id)
  # Make sure we have only one Topic instance
  post.topic = topic
end

```

سأنتقل إلى #Contribute > Bug في حال اعتقاد شخص آخر أن هذه مشكلة.

لكن هذا يعمل:

```plaintext
        if !post.topic # posts in delted topics have no topic and break PostRevisor
           post.topic = Topic.with_deleted.find_by(id: post.topic_id)
           next if !post.topic
        end
        PostRevisor.new(post).revise!(system_user, raw: new_raw, **revision_options)

```

كانت هناك منشورات في 3 مواضيع تسببت في تعطل Rails. أنا أستسلم من أجل ذلك. 🙂

---

_[View the full topic](https://meta.discourse.org/t/postrevisor-cant-revise-posts-in-deleted-topics/347130)._
