Only add tags in the "tags" scope

This commit is contained in:
Michael 2018-03-26 06:11:55 +00:00
parent e65bd0325e
commit 6b84cb9715

View File

@ -1378,7 +1378,7 @@ class PortableContact
dba::insert('gserver', $fields);
}
if (in_array($fields['network'], [NETWORK_DFRN, NETWORK_DIASPORA])) {
if (!$failure && in_array($fields['network'], [NETWORK_DFRN, NETWORK_DIASPORA])) {
self::discoverRelay(server_url);
}
@ -1410,10 +1410,12 @@ class PortableContact
dba::update('gserver', $fields, ['id' => $gserver['id']]);
dba::delete('gserver-tag', ['gserver-id' => $gserver['id']]);
if ($data->scope == 'tags') {
foreach ($data->tags as $tag) {
dba::insert('gserver-tag', ['gserver-id' => $gserver['id'], 'tag' => $tag]);
}
}
}
/**
* @brief Returns a list of all known servers