mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: Deleted posts were showing the wrong dates in the timeline
This commit is contained in:
parent
9ec56775de
commit
6da097d91c
2 changed files with 7 additions and 2 deletions
|
@ -11,10 +11,10 @@ module TimelineLookup
|
|||
tuples.each_with_index do |t, idx|
|
||||
next unless (idx % every) === 0
|
||||
|
||||
_, post_number, days_ago = t
|
||||
days_ago = t[2]
|
||||
|
||||
if (days_ago != last_days_ago)
|
||||
result << [post_number, days_ago]
|
||||
result << [idx+1, days_ago]
|
||||
last_days_ago = days_ago
|
||||
end
|
||||
|
||||
|
|
|
@ -16,6 +16,11 @@ describe TimelineLookup do
|
|||
expect(result).to eq([[1, 10], [3, 8]])
|
||||
end
|
||||
|
||||
it "respects holes in the post numbers" do
|
||||
result = TimelineLookup.build([[111, 1, 10], [222, 12, 10], [333, 30, 8]])
|
||||
expect(result).to eq([[1, 10], [3, 8]])
|
||||
end
|
||||
|
||||
it "respects a `max_values` setting" do
|
||||
input = (1..100).map {|i| [1000+i, i, 100-i] }
|
||||
|
||||
|
|
Loading…
Reference in a new issue