mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 02:15:19 +00:00
refactor "permit-all-likes"
This commit is contained in:
parent
6c42dcf948
commit
f9fea6b5e6
4 changed files with 6 additions and 2 deletions
|
@ -4055,7 +4055,7 @@ class Activity
|
||||||
$allowed = perm_is_allowed($channel['channel_id'], $item['author_xchan'], 'post_comments');
|
$allowed = perm_is_allowed($channel['channel_id'], $item['author_xchan'], 'post_comments');
|
||||||
|
|
||||||
// Allow likes from strangers if permitted to do so. These are difficult (but not impossible) to spam.
|
// Allow likes from strangers if permitted to do so. These are difficult (but not impossible) to spam.
|
||||||
if ($item['verb'] === 'Like' && PConfig::Get($channel['channel_id'], 'system', 'permit_all_likes', true)) {
|
if ($item['verb'] === 'Like' && PConfig::Get($channel['channel_id'], 'system', 'permit_all_likes') && $item['obj_type'] === 'Note') {
|
||||||
$allowed = true;
|
$allowed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ class Channel
|
||||||
$mailhost = ((array_key_exists('mailhost', $_POST)) ? notags(trim($_POST['mailhost'])) : '');
|
$mailhost = ((array_key_exists('mailhost', $_POST)) ? notags(trim($_POST['mailhost'])) : '');
|
||||||
$profile_assign = ((x($_POST, 'profile_assign')) ? notags(trim($_POST['profile_assign'])) : '');
|
$profile_assign = ((x($_POST, 'profile_assign')) ? notags(trim($_POST['profile_assign'])) : '');
|
||||||
$permit_all_mentions = (($_POST['permit_all_mentions'] == 1) ? 1 : 0);
|
$permit_all_mentions = (($_POST['permit_all_mentions'] == 1) ? 1 : 0);
|
||||||
|
$permit_all_likes = (($_POST['permit_all_likes'] == 1) ? 1 : 0);
|
||||||
$close_comment_days = (($_POST['close_comments']) ? intval($_POST['close_comments']) : 0);
|
$close_comment_days = (($_POST['close_comments']) ? intval($_POST['close_comments']) : 0);
|
||||||
set_pconfig(local_channel(), 'system', 'close_comments', $close_comment_days ? $close_comment_days . ' days' : '');
|
set_pconfig(local_channel(), 'system', 'close_comments', $close_comment_days ? $close_comment_days . ' days' : '');
|
||||||
|
|
||||||
|
@ -176,6 +177,7 @@ class Channel
|
||||||
set_pconfig(local_channel(), 'system', 'autoperms', $this->autoperms);
|
set_pconfig(local_channel(), 'system', 'autoperms', $this->autoperms);
|
||||||
set_pconfig(local_channel(), 'system', 'tag_username', $tag_username);
|
set_pconfig(local_channel(), 'system', 'tag_username', $tag_username);
|
||||||
set_pconfig(local_channel(), 'system', 'permit_all_mentions', $permit_all_mentions);
|
set_pconfig(local_channel(), 'system', 'permit_all_mentions', $permit_all_mentions);
|
||||||
|
set_pconfig(local_channel(), 'system', 'permit_all_likes', $permit_all_likes);
|
||||||
set_pconfig(local_channel(), 'system', 'unless_mention_count', $unless_mention_count);
|
set_pconfig(local_channel(), 'system', 'unless_mention_count', $unless_mention_count);
|
||||||
set_pconfig(local_channel(), 'system', 'unless_tag_count', $unless_tag_count);
|
set_pconfig(local_channel(), 'system', 'unless_tag_count', $unless_tag_count);
|
||||||
set_pconfig(local_channel(), 'system', 'noindex', $noindex);
|
set_pconfig(local_channel(), 'system', 'noindex', $noindex);
|
||||||
|
@ -533,6 +535,7 @@ class Channel
|
||||||
'$desktop_notifications_request' => t('Grant permission'),
|
'$desktop_notifications_request' => t('Grant permission'),
|
||||||
'$mailhost' => ['mailhost', t('Email notifications sent from (hostname)'), get_pconfig(local_channel(), 'system', 'email_notify_host', App::get_hostname()), sprintf(t('If your channel is mirrored to multiple locations, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'), App::get_hostname())],
|
'$mailhost' => ['mailhost', t('Email notifications sent from (hostname)'), get_pconfig(local_channel(), 'system', 'email_notify_host', App::get_hostname()), sprintf(t('If your channel is mirrored to multiple locations, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'), App::get_hostname())],
|
||||||
'$permit_all_mentions' => ['permit_all_mentions', t('Accept messages from strangers which mention you'), get_pconfig(local_channel(), 'system', 'permit_all_mentions'), t('This setting bypasses normal permissions'), $yes_no],
|
'$permit_all_mentions' => ['permit_all_mentions', t('Accept messages from strangers which mention you'), get_pconfig(local_channel(), 'system', 'permit_all_mentions'), t('This setting bypasses normal permissions'), $yes_no],
|
||||||
|
'$permit_all_likes' => ['permit_all_likes', t('Accept likes from strangers'), get_pconfig(local_channel(), 'system', 'permit_all_likes'), t('This setting bypasses normal permissions'), $yes_no],
|
||||||
'$followed_tags' => ['followed_tags', t('Accept messages from strangers which include any of the following hashtags'), $followed, t('comma separated, do not include the #')],
|
'$followed_tags' => ['followed_tags', t('Accept messages from strangers which include any of the following hashtags'), $followed, t('comma separated, do not include the #')],
|
||||||
'$unless_mention_count' => ['unless_mention_count', t('Unless more than this many channels are mentioned'), $mention_count, t('0 for unlimited')],
|
'$unless_mention_count' => ['unless_mention_count', t('Unless more than this many channels are mentioned'), $mention_count, t('0 for unlimited')],
|
||||||
'$unless_tag_count' => ['unless_tag_count', t('Unless more than this many hashtags are used'), $tag_count, t('0 for unlimited')],
|
'$unless_tag_count' => ['unless_tag_count', t('Unless more than this many hashtags are used'), $tag_count, t('0 for unlimited')],
|
||||||
|
|
|
@ -2823,7 +2823,7 @@ function tgroup_check($uid, $item) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PConfig::Get($uid, 'system','permit_all_likes',true) && $item['verb'] === 'Like') {
|
if (PConfig::Get($uid, 'system','permit_all_likes') && $item['verb'] === 'Like' && $item['obj_type'] === 'Note') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
{{include file="field_select.tpl" field=$mail_perms}}
|
{{include file="field_select.tpl" field=$mail_perms}}
|
||||||
{{include file="field_select.tpl" field=$view_contact_perms}}
|
{{include file="field_select.tpl" field=$view_contact_perms}}
|
||||||
{{include file="field_select.tpl" field=$search_perms}}
|
{{include file="field_select.tpl" field=$search_perms}}
|
||||||
|
{{include file="field_checkbox.tpl" field=$permit_all_likes}}
|
||||||
{{include file="field_checkbox.tpl" field=$permit_all_mentions}}
|
{{include file="field_checkbox.tpl" field=$permit_all_mentions}}
|
||||||
{{include file="field_input.tpl" field=$unless_mention_count}}
|
{{include file="field_input.tpl" field=$unless_mention_count}}
|
||||||
{{include file="field_input.tpl" field=$followed_tags}}
|
{{include file="field_input.tpl" field=$followed_tags}}
|
||||||
|
|
Loading…
Reference in a new issue