This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -139,14 +139,27 @@ def format_topic_header(topic)
139139
140140 # Add creation date
141141 header << "Created: #{ format_date ( topic . created_at ) } \n "
142- header << "Topic url: /t/#{ topic . id } \n \n "
142+ header << "Topic url: /t/#{ topic . id } \n "
143+ header << "Status: #{ format_topic_status ( topic ) } \n \n "
143144
144145 header
145146 end
146147
148+ def format_topic_status ( topic )
149+ solved = topic . respond_to? ( :solved ) && topic . solved . present?
150+ solved_text = solved ? " (solved)" : ""
151+ if topic . archived?
152+ "Archived#{ solved_text } "
153+ elsif topic . closed?
154+ "Closed#{ solved_text } "
155+ else
156+ "Open#{ solved_text } "
157+ end
158+ end
159+
147160 def format_post ( post )
148161 text = +"---\n "
149- text << "## Post by #{ post . user . username } - #{ format_date ( post . created_at ) } \n \n "
162+ text << "## Post by #{ post . user & .username } - #{ format_date ( post . created_at ) } \n \n "
150163 text << "#{ post . raw } \n "
151164 text << "Likes: #{ post . like_count } \n " if post . like_count . to_i > 0
152165 text << "Post url: /t/-/#{ post . topic_id } /#{ post . post_number } \n \n "
You can’t perform that action at this time.
0 commit comments