if (!scopeOnly) {
self._config.set(field, $('#' + field).val());
}
- self._config.set(field + 'Scope', $('#' + field + 'scope').val());
+ // A scope could have been stored as null due to a previous bug.
+ // Null values should be kept as such until the user explicitly
+ // sets the right value, but they will be returned as empty
+ // strings in the template (which would overwrite the null value
+ // if sent). Due to this an extra class is needed to
+ // differentiate them.
+ var initialScopeValue = $('#' + field + 'scope').hasClass('corrupted-scope-value') ? undefined : $('#' + field + 'scope').val();
+ self._config.set(field + 'Scope', initialScopeValue);
// Set inputs whenever model values change
if (!scopeOnly) {
$icon.addClass('icon-link');
$icon.removeClass('hidden');
break;
+ case '':
+ case null:
+ case undefined:
+ $icon.addClass('icon-error');
+ $icon.removeClass('hidden');
+ break;
}
}
});
</div>
</div>
<span class="icon-checkmark hidden"></span>
- <input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>">
+ <input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>"<?php if (is_null($_['avatarScope'])): ?> class="corrupted-scope-value"<?php endif ?>>
</form>
</div>
<div class="personal-settings-setting-box personal-settings-group-box section">
<?php } ?>
<span class="icon-checkmark hidden"></span>
<span class="icon-error hidden" ></span>
- <input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>">
+ <input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>"<?php if (is_null($_['displayNameScope'])): ?> class="corrupted-scope-value"<?php endif ?>>
</form>
</div>
<div class="personal-settings-setting-box">
<?php if ($_['displayNameChangeSupported']) { ?>
<em><?php p($l->t('For password reset and notifications')); ?></em>
<?php } ?>
- <input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>">
+ <input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>"<?php if (is_null($_['emailScope'])): ?> class="corrupted-scope-value"<?php endif ?>>
</form>
</div>
<?php if (!empty($_['phone']) || $_['lookupServerUploadEnabled']) { ?>
placeholder="<?php p($l->t('Your phone number')); ?>"
autocomplete="on" autocapitalize="none" autocorrect="off" />
<span class="icon-checkmark hidden"></span>
- <input type="hidden" id="phonescope" value="<?php p($_['phoneScope']) ?>">
+ <input type="hidden" id="phonescope" value="<?php p($_['phoneScope']) ?>"<?php if (is_null($_['phoneScope'])): ?> class="corrupted-scope-value"<?php endif ?>>
</form>
</div>
<?php } ?>
value="<?php p($_['address']) ?>"
autocomplete="on" autocapitalize="none" autocorrect="off" />
<span class="icon-checkmark hidden"></span>
- <input type="hidden" id="addressscope" value="<?php p($_['addressScope']) ?>">
+ <input type="hidden" id="addressscope" value="<?php p($_['addressScope']) ?>"<?php if (is_null($_['addressScope'])): ?> class="corrupted-scope-value"<?php endif ?>>
</form>
</div>
<?php } ?>
} ?>
/>
<span class="icon-checkmark hidden"></span>
- <input type="hidden" id="websitescope" value="<?php p($_['websiteScope']) ?>">
+ <input type="hidden" id="websitescope" value="<?php p($_['websiteScope']) ?>"<?php if (is_null($_['websiteScope'])): ?> class="corrupted-scope-value"<?php endif ?>>
</form>
</div>
<?php } ?>
} ?>
/>
<span class="icon-checkmark hidden"></span>
- <input type="hidden" id="twitterscope" value="<?php p($_['twitterScope']) ?>">
+ <input type="hidden" id="twitterscope" value="<?php p($_['twitterScope']) ?>"<?php if (is_null($_['twitterScope'])): ?> class="corrupted-scope-value"<?php endif ?>>
</form>
</div>
<?php } ?>