The discussion revolves around the issue of deleting a topic without a category in Discourse. steinjer initially reported being unable to delete a topic with an ID of3, which had a category ID of4 that no longer existed. JammyDodger suggested that the topic might be an ‘About topic’ for the General category, which would normally be undeletable in the UI. pfaffman proposed a solution using the rails console to update the topic’s category ID, but this did not work for steinjer. Eventually, steinjer managed to delete the topic directly in the rails console using ActiveRecord::Base.lease_connection.exec_delete('DELETE FROM topics WHERE id =3'). Although this solved the issue with the non-deletable post, it did not fix the error with the category link in the sidebar, which steinjer plans to investigate further. JammyDodger noted that it is interesting that the problem only arose after the category had been deleted for several years.
יש לי נושא במסד הנתונים שלנו עם category_id של קטגוריה שנמחקה על ידי מישהו. אני יכול לפתוח את הנושא הזה ישירות עם המזהה שלו:
url: …/t/3
בטבלת הנושאים (topics) למזהה (id) = 3 יש קטגוריה (category) = 4. אבל הקטגוריה הזו נמחקה ולא נמצאת בטבלת הקטגוריות (categories). הצלחתי למחוק הרבה מהנושאים האבודים האלה. אבל הנושא הזה לא עובד, מכיוון שהמאפיינים סגור (closed) וארכיון (archived) הם true.
אם אני בוחר בתפריט המוקפץ “מחק לצמיתות” (Permanently Delete) את הנושא הזה, אני מקבל הודעת שגיאה:
“אירעה שגיאה: לנושא זה יש פוסטים שלא נמחקו. נא למחוק אותם לצמיתות לפני מחיקת הנושא לצמיתות.” (An error occurred: This topic has undeleted posts. Please permanently delete them before permanently deleting the topic.)
יש רעיון איך להוסיף קטגוריה פיקטיבית עם מזהה 4 למסד הנתונים או למחוק את הנושא האבוד הזה?
מכיוון שהקטגוריה הזו לא זמינה יותר, מה יותר חשוב: הקישור לכל הקטגוריות בסרגל הצדדי כבר לא עובד.
אם אני מנסה לפתוח …/categories אני מקבל הודעת שגיאה: “שגיאה משהו השתבש.” ובמסוף הדפדפן מוצגת הודעת שגיאה:
Uncaught TypeError: i is null
reason binary.js:7
l item.js:166
get topic.js:1017
ee upload.js:65
get topic.js:1017
get topic.js:1017
eM topic.js:1017
s backup-codes.js:33
n backup-codes.js:33
Z upload.js:65
T backup-codes.js:33
evaluate backup-codes.js:33
_execute backup-codes.js:33
execute backup-codes.js:33
rerender backup-codes.js:33
render theme-setting.js:6
_renderRoots theme-setting.js:6
tA backup-codes.js:33
_renderRoots theme-setting.js:6
_renderRootsTransaction theme-setting.js:6
_revalidate theme-setting.js:6
invoke client-error-handler.js:88
flush client-error-handler.js:88
flush client-error-handler.js:88
_end client-error-handler.js:88
end client-error-handler.js:88
_run client-error-handler.js:88
run client-error-handler.js:88
d bookmark.js:114
Ember 2
_join client-error-handler.js:88
join client-error-handler.js:88
p bookmark.js:114
h bookmark.js:114
$ topic.js:1017
trigger composer-action-title.js:62
transitionStarted add-translation.js:27
loading ace-editor.js:176
D upload.js:65
triggerEvent upload.js:65
trigger form-template-validation.js:54
_handleSlowTransition upload.js:65
invoke client-error-handler.js:88
flush client-error-handler.js:88
flush client-error-handler.js:88
_end client-error-handler.js:88
end client-error-handler.js:88
_runExpiredTimers client-error-handler.js:88
setTimeout handler*setTimeout client-error-handler.js:88
_installTimerTimeout client-error-handler.js:88
_later client-error-handler.js:88
later client-error-handler.js:88
T bookmark.js:114
_triggerAction form-template-validation.js:54
click form-template-validation.js:54
binary.js:7
Uncaught TypeError: i is null
reason binary.js:7
l item.js:166
get topic.js:1017
ee upload.js:65
get topic.js:1017
get topic.js:1017
eM topic.js:1017
s backup-codes.js:33
n backup-codes.js:33
Z upload.js:65
T backup-codes.js:33
evaluate backup-codes.js:33
_execute backup-codes.js:33
execute backup-codes.js:33
rerender backup-codes.js:33
render theme-setting.js:6
_renderRoots theme-setting.js:6
tA backup-codes.js:33
_renderRoots theme-setting.js:6
_renderRootsTransaction theme-setting.js:6
_revalidate theme-setting.js:6
invoke client-error-handler.js:88
flush client-error-handler.js:88
flush client-error-handler.js:88
_end client-error-handler.js:88
end client-error-handler.js:88
_run client-error-handler.js:88
run client-error-handler.js:88
d bookmark.js:114
success base.js:71
l loader.js:1286
fireWith loader.js:1286
jQuery 4
a base.js:71
e named-references.js:49
e named-references.js:49
A base.js:71
_findCategoriesAndTopics item.js:166
k named-references.js:49
w named-references.js:49
invoke client-error-handler.js:88
flush client-error-handler.js:88
flush client-error-handler.js:88
_end client-error-handler.js:88
end client-error-handler.js:88
_runExpiredTimers client-error-handler.js:88
setTimeout handler*setTimeout client-error-handler.js:88
_installTimerTimeout client-error-handler.js:88
_later client-error-handler.js:88
later client-error-handler.js:88
T bookmark.js:114
_triggerAction form-template-validation.js:54
click form-template-validation.js:54
TypeError: t.category_list.categories is undefined
s form-template-validation.js:54
categoriesFrom form-template-validation.js:54
_findCategoriesAndTopics item.js:166
k named-references.js:49
w named-references.js:49
invoke client-error-handler.js:88
flush client-error-handler.js:88
flush client-error-handler.js:88
_end client-error-handler.js:88
end client-error-handler.js:88
_run client-error-handler.js:88
run client-error-handler.js:88
d bookmark.js:114
success base.js:71
l loader.js:1286
fireWith loader.js:1286
jQuery 4
a base.js:71
e named-references.js:49
e named-references.js:49
A base.js:71
_findCategoriesAndTopics item.js:166
k named-references.js:49
w named-references.js:49
invoke client-error-handler.js:88
flush client-error-handler.js:88
flush client-error-handler.js:88
_end client-error-handler.js:88
end client-error-handler.js:88
_runExpiredTimers client-error-handler.js:88
setTimeout handler*setTimeout client-error-handler.js:88
_installTimerTimeout client-error-handler.js:88
_later client-error-handler.js:88
later client-error-handler.js:88
…
Select id, closed, archived, title,category_id
from topics
where id = '3'
result:
id closed archived title category_id
3 true true Über die Kategorie Team 4
Hmm. I thought your broken topic had category_id of 4.
That was my best guess. If you have a budget you might ask for help in Marketplace. I think you’ll need someone to get into rails to see if they can figure it out.
Marketplace is always an option, especially if it’s urgent.
Though a bit more detail here might help jimmy up a community response.
You both seem confident that the root cause is this topic. If data explorer can find it then you should be able to find it in the rails console. If you can find it then you should be able to use post_destroyer on it and delete it from there?
(Though slightly hesitant to recommend it as I’ve not quite connected up the dots to where the issue is)
Hmm. It is unusual to be able to find it one way and not the other.
The rails console can be a bit of a sharp knife so it’d be best to figure out what exactly has gone wrong just to minimise any accidents/knock on effects.
How was this category deleted in the first place?
(Just in case the issue isn’t caused by this stray topic, I’ll throw in the basics of checking safe mode and seeing if there’s any more info about the error in your YourSite/logs page too)
לצערי, זה לא פותר את השגיאה עם קישור הקטגוריה. אבל הבעיה עם הפוסט שלא ניתן למחיקה נפתרה לעת עתה. בעיית הקטגוריה גם היא לא מתועדת ביומן. אני אטפל בזה בימים הקרובים.