mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
Switch from hardcoded community rank to resource.order
The next version of the community index will include the `order` property (re: #6752, osmlab/osm-community-index#114)
This commit is contained in:
+3
-16
@@ -11,19 +11,6 @@ import { utilRebind } from '../util/rebind';
|
||||
|
||||
export function uiSuccess(context) {
|
||||
var MAXEVENTS = 2;
|
||||
|
||||
// All else being equal, rank more "social" communities higher
|
||||
// (anything not in this list receives no adjustment)
|
||||
var COMMUNITYRANK = {
|
||||
'meetup': +5,
|
||||
'slack': +4,
|
||||
'facebook': +3,
|
||||
'reddit': +2,
|
||||
'forum': -2,
|
||||
'mailinglist': -3,
|
||||
'irc': -4
|
||||
};
|
||||
|
||||
var detected = utilDetect();
|
||||
var dispatch = d3_dispatch('cancel');
|
||||
var _changeset;
|
||||
@@ -140,8 +127,8 @@ export function uiSuccess(context) {
|
||||
matchResources.sort(function(a, b) {
|
||||
var aSize = Infinity;
|
||||
var bSize = Infinity;
|
||||
var aRank = COMMUNITYRANK[a.type] || 0;
|
||||
var bRank = COMMUNITYRANK[b.type] || 0;
|
||||
var aOrder = a.order || 0;
|
||||
var bOrder = b.order || 0;
|
||||
|
||||
if (a.featureId) {
|
||||
aSize = data.community.features[a.featureId].properties.area;
|
||||
@@ -150,7 +137,7 @@ export function uiSuccess(context) {
|
||||
bSize = data.community.features[b.featureId].properties.area;
|
||||
}
|
||||
|
||||
return aSize < bSize ? -1 : aSize > bSize ? 1 : bRank - aRank;
|
||||
return aSize < bSize ? -1 : aSize > bSize ? 1 : bOrder - aOrder;
|
||||
});
|
||||
|
||||
body
|
||||
|
||||
Reference in New Issue
Block a user