From ad5a47aecfe843199c50fb394cca6a77d5c12f3d Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Fri, 3 Jan 2014 14:40:43 +0100 Subject: [PATCH] add fetaure switch for acl-automention --- include/acl_selectors.php | 4 ++++ include/features.php | 1 + include/network.php | 1 - js/acl.js | 5 ++++- view/templates/acl_selector.tpl | 3 ++- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 01c2f1d706..3306871d00 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -1,6 +1,7 @@ json_encode($perms['allow_gid']), '$denycid' => json_encode($perms['deny_cid']), '$denygid' => json_encode($perms['deny_gid']), + '$features' => array( + "aclautomention"=>(feature_enabled($user,"aclautomention")?"true":"false") + ), )); diff --git a/include/features.php b/include/features.php index b2712665e1..24955ba104 100644 --- a/include/features.php +++ b/include/features.php @@ -30,6 +30,7 @@ function get_features() { t('Post Composition Features'), array('richtext', t('Richtext Editor'), t('Enable richtext editor')), array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them')), + array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a fourm page is selected/deselected in ACL window.')), ), // Network sidebar widgets diff --git a/include/network.php b/include/network.php index a4538e88ed..a663a6d942 100644 --- a/include/network.php +++ b/include/network.php @@ -617,7 +617,6 @@ function fetch_xrd_links($url) { if(! function_exists('validate_url')) { function validate_url(&$url) { - // no naked subdomains (allow localhost for tests) if(strpos($url,'.') === false && strpos($url,'/localhost/') === false) return false; diff --git a/js/acl.js b/js/acl.js index 76c2f4c195..b57a925462 100644 --- a/js/acl.js +++ b/js/acl.js @@ -1,7 +1,8 @@ -function ACL(backend_url, preset){ +function ACL(backend_url, preset, automention){ that = this; that.url = backend_url; + that.automention = automention; that.kp_timer = null; @@ -35,6 +36,7 @@ function ACL(backend_url, preset){ } ACL.prototype.remove_mention = function(id) { + if (!that.aclautomention) return; var nick = that.data[id].nick; var searchText = "@"+nick+"+"+id+" "; if (tinyMCE.activeEditor===null) { @@ -52,6 +54,7 @@ ACL.prototype.remove_mention = function(id) { } ACL.prototype.add_mention = function(id) { + if (!that.aclautomention) return; var nick = that.data[id].nick; var searchText = "@"+nick+"+"+id+" "; if (tinyMCE.activeEditor===null) { diff --git a/view/templates/acl_selector.tpl b/view/templates/acl_selector.tpl index 7a9514ea86..6b6f1be4a9 100644 --- a/view/templates/acl_selector.tpl +++ b/view/templates/acl_selector.tpl @@ -20,7 +20,8 @@ $(document).ready(function() { if(typeof acl=="undefined"){ acl = new ACL( baseurl+"/acl", - [ {{$allowcid}},{{$allowgid}},{{$denycid}},{{$denygid}} ] + [ {{$allowcid}},{{$allowgid}},{{$denycid}},{{$denygid}} ], + {{$features.aclautomention}} ); } }); -- 2.39.5