mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-16 23:00:51 +03:00
fix user feed
This commit is contained in:
parent
1676ed3847
commit
e232b7e928
|
@ -243,10 +243,8 @@ class ActionUserfeed extends Action {
|
|||
* Устанавливаем формат Ajax ответа
|
||||
*/
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
if (!getRequest('id')) {
|
||||
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
return;
|
||||
}
|
||||
$sId=getRequestStr('id');
|
||||
|
||||
$sType = getRequestStr('type');
|
||||
$iType = null;
|
||||
/**
|
||||
|
@ -258,15 +256,20 @@ class ActionUserfeed extends Action {
|
|||
break;
|
||||
case 'users':
|
||||
$iType = ModuleUserfeed::SUBSCRIBE_TYPE_USER;
|
||||
$sId=getRequestStr('iUserId');
|
||||
break;
|
||||
default:
|
||||
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
return;
|
||||
}
|
||||
if (!$sId) {
|
||||
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Отписываем пользователя
|
||||
*/
|
||||
$this->Userfeed_unsubscribeUser($this->oUserCurrent->getId(), $iType, getRequestStr('id'));
|
||||
$this->Userfeed_unsubscribeUser($this->oUserCurrent->getId(), $iType, $sId);
|
||||
$this->Message_AddNotice($this->Lang_Get('userfeed_subscribes_updated'), $this->Lang_Get('attention'));
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -67,7 +67,7 @@ ls.user_list_add = (function ($) {
|
|||
userfeed: {
|
||||
url: {
|
||||
add: aRouter['feed'] + 'ajaxadduser/',
|
||||
remove: aRouter['feed'] + 'ajaxremoveuser/'
|
||||
remove: aRouter['feed'] + 'unsubscribe/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ ls.user_list_add = (function ($) {
|
|||
oUserList = oContainer.find(_this.options.selectors.user_list),
|
||||
oEmptyAlert = oContainer.find(_this.options.selectors.user_list_empty);
|
||||
|
||||
_this.remove(oContainer.data('type'), oContainer.data('target-id'), oButton.data('user-id'), function (oResponse, iUserId) {
|
||||
_this.remove(oContainer.data('type'), oContainer.data('target-id'), oButton.data('user-id'), oContainer, function (oResponse, iUserId) {
|
||||
oContainer.find(this.options.selectors.user_item + '[data-user-id=' + iUserId + ']').fadeOut(300, function () {
|
||||
$(this).remove();
|
||||
|
||||
|
@ -183,13 +183,15 @@ ls.user_list_add = (function ($) {
|
|||
/**
|
||||
* Удаление пользователя
|
||||
*/
|
||||
this.remove = function(sType, iTargetId, iUserId, fCallbackSuccess) {
|
||||
this.remove = function(sType, iTargetId, iUserId, oContainer,fCallbackSuccess) {
|
||||
var sUrl = this.options.type[sType].url.remove,
|
||||
oParams = {
|
||||
iTargetId: iTargetId,
|
||||
iUserId: iUserId
|
||||
};
|
||||
|
||||
oParams = $.extend({}, oParams, ls.utilities.getDataOptions(oContainer, 'param'));
|
||||
|
||||
ls.ajax.load(sUrl, oParams, function(oResponse) {
|
||||
if (oResponse.bStateError) {
|
||||
ls.msg.error(null, oResponse.sMsg);
|
||||
|
|
|
@ -14,5 +14,6 @@
|
|||
iUserListId = $oUserCurrent->getId()
|
||||
sUserListType = 'userfeed'
|
||||
aUserList = $aUserfeedSubscribedUsers
|
||||
sUserListAddAttributes = 'data-param-type="users"'
|
||||
sUserListNote = $aLang.userfeed_settings_note_follow_user}
|
||||
{/block}
|
|
@ -5,7 +5,7 @@
|
|||
*}
|
||||
|
||||
{* Форма добавления *}
|
||||
<div class="user-list-add js-user-list-add" data-type="{$sUserListType}" data-target-id="{$iUserListId}">
|
||||
<div class="user-list-add js-user-list-add" data-type="{$sUserListType}" data-target-id="{$iUserListId}" {$sUserListAddAttributes}>
|
||||
{* Заголовок *}
|
||||
{if $sUserListTitle}
|
||||
<h3 class="user-list-add-title">{$sUserListTitle}</h3>
|
||||
|
|
Loading…
Reference in a new issue