issue #138 ; make ajaxchat optional and configurable. For reasons we've discussed repeatedly the ajax chat will not be removed from core as XMPP chat does not provide decentralised access control compatible with nomadic identity.

This commit is contained in:
redmatrix 2016-04-03 16:41:40 -07:00
parent 102d41ccb9
commit bf3f3564e0
5 changed files with 18 additions and 3 deletions

View file

@ -1592,6 +1592,7 @@ function network_tabs() {
function profile_tabs($a, $is_owner = false, $nickname = null){ function profile_tabs($a, $is_owner = false, $nickname = null){
// Don't provide any profile tabs if we're running as the sys channel // Don't provide any profile tabs if we're running as the sys channel
if (App::$is_sys) if (App::$is_sys)
return; return;
@ -1669,7 +1670,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
} }
if ($p['chat']) { if ($p['chat'] && feature_enabled($uid,'ajaxchat')) {
require_once('include/chat.php'); require_once('include/chat.php');
$has_chats = chatroom_list_count($uid); $has_chats = chatroom_list_count($uid);
if ($has_chats) { if ($has_chats) {

View file

@ -56,7 +56,7 @@ function get_features($filtered = true) {
array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')), array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')),
array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')), array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')),
array('photo_location', t('Photo Location'), t('If location data is available on uploaded photos, link this to a map.'),false,get_config('feature_lock','photo_location')), array('photo_location', t('Photo Location'), t('If location data is available on uploaded photos, link this to a map.'),false,get_config('feature_lock','photo_location')),
array('ajaxchat', t('Access Controlled Chatrooms'), t('Provide chatrooms and chat services with access control.'),true,get_config('feature_lock','ajaxchat')),
array('smart_birthdays', t('Smart Birthdays'), t('Make birthday events timezone aware in case your friends are scattered across the planet.'),true,get_config('feature_lock','smart_birthdays')), array('smart_birthdays', t('Smart Birthdays'), t('Make birthday events timezone aware in case your friends are scattered across the planet.'),true,get_config('feature_lock','smart_birthdays')),
array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options'),false,get_config('feature_lock','expert')), array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options'),false,get_config('feature_lock','expert')),
array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel'),false,get_config('feature_lock','premium_channel')), array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel'),false,get_config('feature_lock','premium_channel')),

View file

@ -92,7 +92,7 @@ EOT;
$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'),'photos_nav_btn'); $nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'),'photos_nav_btn');
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn'); $nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn');
if(! UNO) if((! UNO) && feature_enabled(local_channel(),'ajaxchat'))
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'], t('Chat'),"",t('Your chatrooms'),'chat_nav_btn'); $nav['usermenu'][] = Array('chat/' . $channel['channel_address'], t('Chat'),"",t('Your chatrooms'),'chat_nav_btn');

View file

@ -785,6 +785,7 @@ function widget_menu_preview($arr) {
function widget_chatroom_list($arr) { function widget_chatroom_list($arr) {
require_once("include/chat.php"); require_once("include/chat.php");
$r = chatroom_list(App::$profile['profile_uid']); $r = chatroom_list(App::$profile['profile_uid']);
@ -808,6 +809,10 @@ function widget_chatroom_members() {
} }
function widget_bookmarkedchats($arr) { function widget_bookmarkedchats($arr) {
if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat'))
return '';
$h = get_observer_hash(); $h = get_observer_hash();
if(! $h) if(! $h)
return; return;
@ -827,6 +832,9 @@ function widget_bookmarkedchats($arr) {
function widget_suggestedchats($arr) { function widget_suggestedchats($arr) {
if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat'))
return '';
// probably should restrict this to your friends, but then the widget will only work // probably should restrict this to your friends, but then the widget will only work
// if you are logged in locally. // if you are logged in locally.

View file

@ -208,6 +208,12 @@ function chat_content(&$a) {
$o = profile_tabs($a,((local_channel() && local_channel() == App::$profile['profile_uid']) ? true : false),App::$profile['channel_address']); $o = profile_tabs($a,((local_channel() && local_channel() == App::$profile['profile_uid']) ? true : false),App::$profile['channel_address']);
if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat')) {
notice( t('Feature disabled.') . EOL);
return $o;
}
$acl = new Zotlabs\Access\AccessList($channel); $acl = new Zotlabs\Access\AccessList($channel);
$channel_acl = $acl->get(); $channel_acl = $acl->get();