mirror of https://github.com/Calamitous/iris.git
Fix bug preventing replies from showing up on edited topics
This commit is contained in:
parent
8c6dcb335e
commit
cb0aca4e54
3
TODO.md
3
TODO.md
|
@ -17,11 +17,12 @@
|
||||||
* ~Mark unread topics/topics with unread replies in topics list~
|
* ~Mark unread topics/topics with unread replies in topics list~
|
||||||
* ~Add column headers for topics~
|
* ~Add column headers for topics~
|
||||||
* ~Document new features~
|
* ~Document new features~
|
||||||
* Keep replies on edited topics
|
* ~Keep replies on edited topics~
|
||||||
|
|
||||||
# Bugs:
|
# Bugs:
|
||||||
* Is `Time.now.utc.iso8601` working as expected?
|
* Is `Time.now.utc.iso8601` working as expected?
|
||||||
* Exclude user's own messages from "unread" count
|
* Exclude user's own messages from "unread" count
|
||||||
|
* Fix message ordering when editing/deleting multiple messages
|
||||||
|
|
||||||
# Tech debt:
|
# Tech debt:
|
||||||
* Flesh out technical sections
|
* Flesh out technical sections
|
||||||
|
|
11
iris.rb
11
iris.rb
|
@ -86,7 +86,7 @@ end
|
||||||
class Corpus
|
class Corpus
|
||||||
def self.load
|
def self.load
|
||||||
@@corpus = Config.find_files.map { |filepath| IrisFile.load_messages(filepath) }.flatten.sort_by(&:timestamp)
|
@@corpus = Config.find_files.map { |filepath| IrisFile.load_messages(filepath) }.flatten.sort_by(&:timestamp)
|
||||||
@@topics = @@corpus.select{ |m| m.parent == nil }
|
@@topics = @@corpus.select{ |m| m.parent == nil && m.show_me? }
|
||||||
@@my_corpus = IrisFile.load_messages.sort_by(&:timestamp)
|
@@my_corpus = IrisFile.load_messages.sort_by(&:timestamp)
|
||||||
@@my_reads = IrisFile.load_reads
|
@@my_reads = IrisFile.load_reads
|
||||||
@@all_hash_to_index = @@corpus.reduce({}) { |agg, msg| agg[msg.hash] = @@corpus.index(msg); agg }
|
@@all_hash_to_index = @@corpus.reduce({}) { |agg, msg| agg[msg.hash] = @@corpus.index(msg); agg }
|
||||||
|
@ -149,7 +149,7 @@ class Corpus
|
||||||
return [] unless hash
|
return [] unless hash
|
||||||
indexes = @@all_parent_hash_to_index[hash]
|
indexes = @@all_parent_hash_to_index[hash]
|
||||||
return [] unless indexes
|
return [] unless indexes
|
||||||
indexes.map{ |idx| displayable[idx] }.compact
|
indexes.map{ |idx| all[idx] }.compact.select(&:show_me?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_topic_by_id(topic_lookup)
|
def self.find_topic_by_id(topic_lookup)
|
||||||
|
@ -447,8 +447,13 @@ class Message
|
||||||
}.to_json
|
}.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def edit_predecessor
|
||||||
|
return nil unless edit_hash
|
||||||
|
Corpus.find_message_by_hash(edit_hash)
|
||||||
|
end
|
||||||
|
|
||||||
def replies
|
def replies
|
||||||
Corpus.find_all_by_parent_hash(hash)
|
(Corpus.find_all_by_parent_hash(hash) + ((edit_predecessor && edit_predecessor.replies) || [])).compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
|
|
Loading…
Reference in New Issue