public static bool CanEdit(this WallPost wallPost, List <Group> knownGroups) { if (wallPost == null || wallPost.to_id == AppGlobalStateManager.Current.LoggedInUserId && wallPost.from_id != AppGlobalStateManager.Current.LoggedInUserId) { return(false); } bool flag = wallPost.CanDelete(knownGroups, true) && ((DateTime.Now - Extensions.UnixTimeStampToDateTime((double)wallPost.date, true)).TotalHours < 24.0 || wallPost.IsSuggestedPostponed); if (wallPost.IsSuggested) { flag = wallPost.from_id == AppGlobalStateManager.Current.LoggedInUserId; } return(flag); }
public static bool CanUnpin(this WallPost wallPost, List <Group> knownGroups) { if (wallPost == null) { return(false); } long loggedInUserId = AppGlobalStateManager.Current.LoggedInUserId; if (wallPost.to_id == loggedInUserId && wallPost.from_id == loggedInUserId && wallPost.is_pinned == 1) { return(true); } Group group = knownGroups == null ? (Group)null : knownGroups.FirstOrDefault <Group>((Func <Group, bool>)(g => g.id == -wallPost.to_id)); return(wallPost.CanDelete(knownGroups, false) && group != null && (wallPost.is_pinned == 1 && wallPost.from_id == wallPost.to_id)); }