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 )

24105 put(a) pogledan, 11 odgovor(a) 2.9.2014. 15:30:32Kreirao(la) asdesigned
asdesigned

asdesigned

2.9.2014. 15:30:32
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
Ovaj sadržaj još nije ocijenjen. 
25 Reputacija 3 Ukupno objava
khorvat

khorvat

3.9.2014. 7:42:17
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
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
asdesigned

asdesigned

3.9.2014. 8:53:03
This could be good, could you ellaborate a little more?
Ovaj sadržaj još nije ocijenjen. 
25 Reputacija 3 Ukupno objava
khorvat

khorvat

3.9.2014. 12:34:39
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
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
asdesigned

asdesigned

3.9.2014. 12:44:43
I'm using 4.8.  
Ovaj sadržaj još nije ocijenjen. 
25 Reputacija 3 Ukupno objava
khorvat

khorvat

4.9.2014. 15:25:48
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
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
Zoomicon

Zoomicon

6.9.2014. 20:55:23

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

Ovaj sadržaj još nije ocijenjen. 
2793 Reputacija 345 Ukupno objava
Zoomicon

Zoomicon

6.9.2014. 20:56:08
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)
Ovaj sadržaj još nije ocijenjen. 
2793 Reputacija 345 Ukupno objava
Zoomicon

Zoomicon

6.9.2014. 20:57:28

...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

Ovaj sadržaj još nije ocijenjen. 
2793 Reputacija 345 Ukupno objava
mzilic

mzilic

8.9.2014. 10:50:39
Hello Zoomicon,

Can you please post your suggestions to the RoadMap forum.

Regards
Ovaj sadržaj još nije ocijenjen. 
2218 Reputacija 300 Ukupno objava
1 2