Fix: subscribing to the old followers hadn't worked

This commit is contained in:
Michael 2018-03-14 00:27:15 +00:00
parent f17f61df38
commit 858fd127a1
5 changed files with 13 additions and 6 deletions

View file

@ -29,12 +29,14 @@ function ostatus_subscribe_content(App $a) {
if (PConfig::get($uid, "ostatus", "legacy_friends") == "") { if (PConfig::get($uid, "ostatus", "legacy_friends") == "") {
if ($_REQUEST["url"] == "") { if ($_REQUEST["url"] == "") {
PConfig::delete($uid, "ostatus", "legacy_contact");
return $o.L10n::t("No contact provided."); return $o.L10n::t("No contact provided.");
} }
$contact = Probe::uri($_REQUEST["url"]); $contact = Probe::uri($_REQUEST["url"]);
if (!$contact) { if (!$contact) {
PConfig::delete($uid, "ostatus", "legacy_contact");
return $o.L10n::t("Couldn't fetch information for contact."); return $o.L10n::t("Couldn't fetch information for contact.");
} }
@ -44,6 +46,7 @@ function ostatus_subscribe_content(App $a) {
$data = Network::curl($api."statuses/friends.json?screen_name=".$contact["nick"]); $data = Network::curl($api."statuses/friends.json?screen_name=".$contact["nick"]);
if (!$data["success"]) { if (!$data["success"]) {
PConfig::delete($uid, "ostatus", "legacy_contact");
return $o.L10n::t("Couldn't fetch friends for contact."); return $o.L10n::t("Couldn't fetch friends for contact.");
} }

View file

@ -207,8 +207,7 @@ function settings_post(App $a)
return; return;
} }
if (($a->argc > 1) && ($a->argv[1] == 'connectors')) if (($a->argc > 1) && ($a->argv[1] == 'connectors')) {
{
check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors'); check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
if (x($_POST, 'general-submit')) { if (x($_POST, 'general-submit')) {

View file

@ -217,7 +217,7 @@ class Network
$newurl = $curl_info['redirect_url']; $newurl = $curl_info['redirect_url'];
if (($new_location_info['path'] == '') && ( $new_location_info['host'] != '')) { if (($new_location_info['path'] == '') && ($new_location_info['host'] != '')) {
$newurl = $new_location_info['scheme'] . '://' . $new_location_info['host'] . $old_location_info['path']; $newurl = $new_location_info['scheme'] . '://' . $new_location_info['host'] . $old_location_info['path'];
} }
@ -229,6 +229,11 @@ class Network
if (strpos($newurl, '/') === 0) { if (strpos($newurl, '/') === 0) {
$newurl = $old_location_info["scheme"]."://".$old_location_info["host"].$newurl; $newurl = $old_location_info["scheme"]."://".$old_location_info["host"].$newurl;
} }
$old_location_query = @parse_url($url, PHP_URL_QUERY);
if ($old_location_query != '') {
$newurl .= '?' . $old_location_query;
}
if (filter_var($newurl, FILTER_VALIDATE_URL)) { if (filter_var($newurl, FILTER_VALIDATE_URL)) {
$redirects++; $redirects++;

View file

@ -22,7 +22,7 @@
<p><a href="{{$repair_ostatus_url}}">{{$repair_ostatus_text}}</a></p> <p><a href="{{$repair_ostatus_url}}">{{$repair_ostatus_text}}</a></p>
<div class="settings-submit-wrapper" ><input type="submit" name="general-submit" class="settings-submit" value="{{$submit}}" /></div> <div class="settings-submit-wrapper" ><input type="submit" id="general-submit" name="general-submit" class="settings-submit" value="{{$submit}}" /></div>
</div> </div>
<div class="clear"></div> <div class="clear"></div>

View file

@ -28,7 +28,7 @@
<p><a href="{{$repair_ostatus_url}}">{{$repair_ostatus_text}}</a></p> <p><a href="{{$repair_ostatus_url}}">{{$repair_ostatus_text}}</a></p>
<div class="form-group pull-right settings-submit-wrapper" > <div class="form-group pull-right settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit|escape:'html'}}">{{$submit}}</button> <button type="submit" id="general-submit" name="general-submit" class="btn btn-primary" value="{{$submit|escape:'html'}}">{{$submit}}</button>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
@ -67,4 +67,4 @@
{{/if}} {{/if}}
</form> </form>
</div> </div>