MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

user activity stream for friends only  (Mono Support )

Viewed 21085 time(s), 11 post(s) 9/2/2014 3:30:32 PMby asdesigned
asdesigned

asdesigned

9/2/2014 3:30:32 PM
Hi guys, i've been playing around with Monox for a little while and was wondering if there was a way to just show friends activity in the activity stream?  It seems as though it shows other user's activity, but I really just want it to show only the activity from a user's friends
This content has not been rated yet. 
25 Reputation 3 Total posts
khorvat

khorvat

9/3/2014 7:42:17 AM
Hi,

this can be done, but you will have to inherit few controls and classes and modify initial filter in order to get only friends in the activity stream. Let me know if this is an option for you ?

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
asdesigned

asdesigned

9/3/2014 8:53:03 AM
This could be good, could you ellaborate a little more?
This content has not been rated yet. 
25 Reputation 3 Total posts
khorvat

khorvat

9/3/2014 12:34:39 PM
Hi,

can you let us know if you are using 4.9 or 5.x version of MonoX ? Implementation is different depending on version as MonoX 5.x is using dependency injection and 4.9 isn't.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
asdesigned

asdesigned

9/3/2014 12:44:43 PM
I'm using 4.8.  
This content has not been rated yet. 
25 Reputation 3 Total posts
khorvat

khorvat

9/4/2014 3:25:48 PM
Hi,

you will need to inherit from the following WebParts and classes:

- inherit your repository from NoteRepository 
- override the GetNotes(Guid? languageId, Guid userId, Guid groupId, Guid wallOwnerId, int pageNumber, int pageSize, out int recordCount) method - you need to put your filter for friends here
- put code similar to this in your overridden GetNotes method (Note: this is only a sample code, this is not a fully functional code and you shouldn't expect this code to work as is!)

01.EntityCollection<SnNoteEntity> notes = new EntityCollection<SnNoteEntity>();
02.RelationPredicateBucket filter = new RelationPredicateBucket();
03.filter.PredicateExpression.Add(SnNoteFields.NoteContent != string.Empty);
04.filter.PredicateExpression.Add(SnNoteFields.ApplicationId == MembershipRepository.GetInstance().GetApplicationId();
05.if (languageId.HasValue)
06.    filter.PredicateExpression.Add(SnNoteFields.LanguageId == languageId);
07. 
08.filter.PredicateExpression.Add(SnNoteFields.GroupId == DBNull.Value);
09. 
10.filter.Relations.Add(SnNoteEntity.Relations.AspnetUsersEntityUsingUserId);
11.filter.PredicateExpression.Add(SnNoteFields.PostToUserId == wallOwnerId);
12.//if this is the owner
13.if (wallOwnerId == SecurityUtility.GetUserId())
14.{
15.    PredicateExpression peFriend = GetFriendPrivacyFilter();
16.    filter.PredicateExpression.Add(peFriend);
17.}
18.//if this is owner's friend, show everything except private notes
19.else if (FriendRepository.GetInstance().RelationshipExists(userId, wallOwnerId))
20.{
21.    PredicateExpression pe = new PredicateExpression();
22.    PredicateExpression pePrivate = new PredicateExpression();
23.    pePrivate.Add(SnNoteFields.PostToUserId == wallOwnerId);
24.    pePrivate.Add(SnNoteFields.UserId == userId);
25.    PredicateExpression peFriend = GetFriendPrivacyFilter();
26.    pe.Add(pePrivate);
27.    pe.AddWithOr(peFriend);
28.    filter.PredicateExpression.Add(pe);
29.}
- inherit mark-up and the code from "~\MonoX\ModuleGallery\SocialNetworking\WallNotes.ascx"
- in the code behind of your inherited class, you need to override BindData()
- in the BindData you need to put this code:

01.int recordCount = 0;
02. 
03.Guid userId = SecurityUtility.GetUserId();
04.EntityCollection<SnNoteEntity> posts = YourRepositoryInstance.
05.    GetNotes(userId, this.GroupId, this.UserId, pager.CurrentPageIndex + 1, pager.PageSize, out recordCount);
06.PagerUtility.BindPager(pager, BindData, lvItems, posts, recordCount);
07.if (recordCount == 0)
08.    lblNoData.Visible = true;
09.else
10.    lblNoData.Visible = false;
- from now on you need to use your inherited WebPart in order to show the WallNotes with notes only from your friends 

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
Zoomicon

Zoomicon

9/6/2014 8:55:23 PM

In communities with many users, the activity stream becomes just noise if you can't filter it to show activity from your friends only. The default should be that btw, and optionally be able to see all activity.

Moreover, social networks like Facebook don't show all activity also for privacy reasons (there are people who don't want their activity shown everywhere) I guess, but only show you friends' activity

This content has not been rated yet. 
2793 Reputation 345 Total posts
Zoomicon

Zoomicon

9/6/2014 8:56:08 PM
regarding my privacy comments above, obviously admins should always have option to see all activity (and also moderators should be able to do this in their groups)
This content has not been rated yet. 
2793 Reputation 345 Total posts
Zoomicon

Zoomicon

9/6/2014 8:57:28 PM

...speaking of groups, taking part in a group should automatically list you to see all its activity (actions of its other members that affect the group resources though) I guess

This content has not been rated yet. 
2793 Reputation 345 Total posts
mzilic

mzilic

9/8/2014 10:50:39 AM
Hello Zoomicon,

Can you please post your suggestions to the RoadMap forum.

Regards
This content has not been rated yet. 
2218 Reputation 300 Total posts
1 2