Quantcast
Channel: Active questions tagged chatter-feed - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 191

Set Chatter Msssage to Readed Is Not Work

$
0
0

I meet a problem what make me feel confused

Here is My Vf Page , As You See , It Will Refresh Itself E

function myrefresh(){
        window.location.reload();
}
setTimeout('myrefresh()',60000); 

And This Is The Controller Initialize , It Will Get Chatter Message From The Current User.And We Will Be Filter Whick Is Readed.Only Show Unread Messages

public MessageRemindingController(){

  ConnectApi.FeedElementPage fep = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(Network.getNetworkId(), ConnectApi.FeedType.To, 'me');

  List<ConnectApi.FeedElement> feeds = new List<ConnectApi.FeedElement> ();
  if (fep.elements != null)
  {
    for (ConnectApi.FeedElement p : fep.elements)
    {
      if (p.capabilities != null && !p.capabilities.readBy.isReadByMe)
          feeds.add(p);
    }

    //fep.elements = feeds;
  }

  System.debug('*** fep: ' + JSON.serializePretty(feeds) + '');
  ChatterJSON = JSON.serialize(feeds);
  nextpageToken=fep.nextPageToken;
}

And The Problem Is , When i Click The AllRead button , I WIll Fire The Function.We Will Mark All Messages Be Readed.

 List<String> updateIds = new List<String>();
          updateIds.addAll(markIds);
          lstBatchResult  = ConnectApi.ChatterFeeds.updateFeedElementReadByCapabilityBatch(communityId, updateIds, true);
        }
      }
      System.debug('*** lstBatchResult: ' + JSON.serializePretty(lstBatchResult) + '');

The Result of Debug Log is Like This. What Show The Result Is Right,All The Attribute "isReadByme" of Messages is True. enter image description here

Then , The Strange is Coming . When We Reload This Page. We Will See That All Messages Is Still Unreaded. enter image description here

Who CAn Tell ME , Why It Happen?


Viewing all articles
Browse latest Browse all 191

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>