Only allow editing of mail/feed contact details

This commit is contained in:
Michael 2020-10-10 10:06:34 +00:00
parent ae6b380362
commit b3e14fd07d

View file

@ -125,6 +125,14 @@ class Advanced extends BaseModule
$remote_self_options = ['0' => DI::l10n()->t('No mirroring'), '2' => DI::l10n()->t('Mirror as my own posting')]; $remote_self_options = ['0' => DI::l10n()->t('No mirroring'), '2' => DI::l10n()->t('Mirror as my own posting')];
} }
// This data is fetched automatically for most networks.
// Editing does only makes sense for mail and feed contacts.
if (!in_array($contact['network'], [Protocol::FEED, Protocol::MAIL])) {
$readonly = 'readonly';
} else {
$readonly = '';
}
$tab_str = Contact::getTabsHTML($contact, Contact::TAB_ADVANCED); $tab_str = Contact::getTabsHTML($contact, Contact::TAB_ADVANCED);
$tpl = Renderer::getMarkupTemplate('contact/advanced.tpl'); $tpl = Renderer::getMarkupTemplate('contact/advanced.tpl');
@ -147,16 +155,16 @@ class Advanced extends BaseModule
$remote_self_options $remote_self_options
], ],
'$name' => ['name', DI::l10n()->t('Name'), $contact['name']], '$name' => ['name', DI::l10n()->t('Name'), $contact['name'], '', '', $readonly],
'$nick' => ['nick', DI::l10n()->t('Account Nickname'), $contact['nick']], '$nick' => ['nick', DI::l10n()->t('Account Nickname'), $contact['nick'], '', '', $readonly],
'$attag' => ['attag', DI::l10n()->t('@Tagname - overrides Name/Nickname'), $contact['attag']], '$attag' => ['attag', DI::l10n()->t('@Tagname - overrides Name/Nickname'), $contact['attag']],
'$url' => ['url', DI::l10n()->t('Account URL'), $contact['url']], '$url' => ['url', DI::l10n()->t('Account URL'), $contact['url'], '', '', $readonly],
'$alias' => ['alias', DI::l10n()->t('Account URL Alias'), $contact['alias']], '$alias' => ['alias', DI::l10n()->t('Account URL Alias'), $contact['alias'], '', '', $readonly],
'$request' => ['request', DI::l10n()->t('Friend Request URL'), $contact['request']], '$request' => ['request', DI::l10n()->t('Friend Request URL'), $contact['request'], '', '', $readonly],
'confirm' => ['confirm', DI::l10n()->t('Friend Confirm URL'), $contact['confirm']], 'confirm' => ['confirm', DI::l10n()->t('Friend Confirm URL'), $contact['confirm'], '', '', $readonly],
'notify' => ['notify', DI::l10n()->t('Notification Endpoint URL'), $contact['notify']], 'notify' => ['notify', DI::l10n()->t('Notification Endpoint URL'), $contact['notify'], '', '', $readonly],
'poll' => ['poll', DI::l10n()->t('Poll/Feed URL'), $contact['poll']], 'poll' => ['poll', DI::l10n()->t('Poll/Feed URL'), $contact['poll'], '', '', $readonly],
'photo' => ['photo', DI::l10n()->t('New photo from this URL'), ''], 'photo' => ['photo', DI::l10n()->t('New photo from this URL'), '', '', '', $readonly],
]); ]);
} }
} }