Merge pull request #9404 from annando/advanced-readonly

Only allow editing of mail/feed contact details
This commit is contained in:
Tobias Diekershoff 2020-10-10 12:25:46 +02:00 committed by GitHub
commit ea82b80c38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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],
]); ]);
} }
} }