<p><b>@rugk</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2381#discussion_r357977147">app/controllers/api/notes_controller.rb</a>:</p>
<pre style='color:#555'>> - @notes = @notes.order("updated_at DESC").limit(result_limit).preload(:comments)
+ @notes = if params[:sort] == "created_at"
+ if params[:order] == "oldest"
+ @notes.order("created_at ASC")
+ else
+ @notes.order("created_at DESC")
+ end
+ else
+ if params[:order] == "oldest"
+ @notes.order("updated_at ASC")
+ else
+ @notes.order("updated_at DESC")
+ end
+ end
+
+ @notes = @notes.distinct.limit(result_limit).preload(:comments)
</pre>
<p>This does fix a big problem with duplicate notes, see <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="534421874" data-permission-text="Issue title is private" data-url="https://github.com/ENT8R/NotesReview/issues/43" data-hovercard-type="issue" data-hovercard-url="/ENT8R/NotesReview/issues/43/hovercard" href="https://github.com/ENT8R/NotesReview/issues/43">ENT8R/NotesReview#43</a></p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2381?email_source=notifications&email_token=AAK2OLLJRFZRH2M5XOG2H53QYYS3FA5CNFSM4I5CYR2KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCPG62HA#discussion_r357977147">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNS4C7WM2HUTGPJTR3QYYS3FANCNFSM4I5CYR2A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAK2OLPJ3SZWZRW5MPGNJMLQYYS3FA5CNFSM4I5CYR2KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCPG62HA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/2381?email_source=notifications\u0026email_token=AAK2OLLJRFZRH2M5XOG2H53QYYS3FA5CNFSM4I5CYR2KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCPG62HA#discussion_r357977147",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/2381?email_source=notifications\u0026email_token=AAK2OLLJRFZRH2M5XOG2H53QYYS3FA5CNFSM4I5CYR2KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCPG62HA#discussion_r357977147",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>