Skip to content

Commit

Permalink
add fetaure switch for acl-automention
Browse files Browse the repository at this point in the history
  • Loading branch information
fabrixxm committed Jan 3, 2014
1 parent 53dc1ce commit ad5a47a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions include/acl_selectors.php
@@ -1,6 +1,7 @@
<?php

require_once("include/contact_selectors.php");
require_once("include/features.php");

/**
*
Expand Down Expand Up @@ -329,6 +330,9 @@ function populate_acl($user = null,$celeb = false) {
'$allowgid' => 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")
),
));


Expand Down
1 change: 1 addition & 0 deletions include/features.php
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion include/network.php
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion 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;

Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion view/templates/acl_selector.tpl
Expand Up @@ -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}}
);
}
});
Expand Down

0 comments on commit ad5a47a

Please sign in to comment.