Notification executing twice.
Hi guys,
I have a notification issue. The issue is notification executing twice everytime. When any of user mentioning me at any post its executing twice .i.e. some one mentioned you in post. Notification is coming twice instead of once. I assume its a rest error. Following is the code. If anybody suggest me what iam doing wrong that will be helpful.
<#assign _notificationsCount = restadmin( '/users/id/' + user.id + '/notifications/count' ).value?number />
<#if ( _notificationsCount > 999 )>
<#assign _notificationsCount = 999 />
</#if>
<#assign notifications = [] />
<#assign allowed = [ 'kudos', 'mentions', 'solutions', 'badge', 'rank' ] />
<#assign notificationsPage = 1 />
<#assign usedNotifications = [] />
<#function getNotifications>
<#assign page = notificationsPage * pageSize />
<#assign nots = restadmin( '/users/id/' + user.id + '/notifications?restapi.response_style=view&page_size=' + page ).notifications />
<#if ( nots?size > 0 )>
<#list nots.notification as notification>
<#if ( ( !usedNotifications?seq_contains( notification_index ) ) && ( allowed?seq_contains( notification.notification_type ) ) && ( notifications?size < pageSize ) )>
<#assign notifications = notifications + [notification]>
<#assign usedNotifications = usedNotifications + [notification_index]>
<#assign i = i + 1 />
</#if>
</#list>
<#if ( (notifications?size < pageSize) && ( ( _notificationsCount - page ) > 0 ) && (notifications?size < i))>
<#assign notificationsPage = notificationsPage + 1 />
<#assign go = getNotifications() />
</#if>
</#if>
<#return 1 />
</#function>
Hi guys,
I found fix for this. Sharing it with you, in case you will face such kind issue. There was a default navigaton called on header navigation. I was just checking on community header instead of header section. Now I removed it and used custom notification I made.
<component id="common.widget.user-navigation"/>
Silly Mistake :)