@@ -841,33 +841,26 @@ public virtual bool IsCustomerAllowedToCreateTopic(Customer customer, Forum foru
841841
842842 public virtual bool IsCustomerAllowedToEditTopic ( Customer customer , ForumTopic topic )
843843 {
844- if ( topic == null || customer == null || customer . IsGuest ( ) )
844+ if ( customer != null && topic != null )
845845 {
846- return false ;
847- }
848-
849- if ( customer . IsForumModerator ( ) )
850- {
851- return true ;
852- }
846+ if ( customer . IsForumModerator ( ) )
847+ {
848+ return true ;
849+ }
853850
854- if ( _forumSettings . AllowCustomersToEditPosts && topic . Published )
855- {
856- var ownTopic = customer . Id == topic . CustomerId ;
857- return ownTopic ;
851+ if ( _forumSettings . AllowCustomersToEditPosts && topic . Published )
852+ {
853+ var ownTopic = customer . Id == topic . CustomerId ;
854+ return ownTopic ;
855+ }
858856 }
859857
860858 return false ;
861859 }
862860
863861 public virtual bool IsCustomerAllowedToMoveTopic ( Customer customer , ForumTopic topic )
864862 {
865- if ( topic == null || customer == null || customer . IsGuest ( ) )
866- {
867- return false ;
868- }
869-
870- if ( customer . IsForumModerator ( ) )
863+ if ( customer != null && customer . IsForumModerator ( ) )
871864 {
872865 return true ;
873866 }
@@ -877,20 +870,18 @@ public virtual bool IsCustomerAllowedToMoveTopic(Customer customer, ForumTopic t
877870
878871 public virtual bool IsCustomerAllowedToDeleteTopic ( Customer customer , ForumTopic topic )
879872 {
880- if ( topic == null || customer == null || customer . IsGuest ( ) )
873+ if ( topic != null && customer != null )
881874 {
882- return false ;
883- }
884-
885- if ( customer . IsForumModerator ( ) )
886- {
887- return true ;
888- }
875+ if ( customer . IsForumModerator ( ) )
876+ {
877+ return true ;
878+ }
889879
890- if ( _forumSettings . AllowCustomersToDeletePosts && topic . Published )
891- {
892- var ownTopic = customer . Id == topic . CustomerId ;
893- return ownTopic ;
880+ if ( _forumSettings . AllowCustomersToDeletePosts && topic . Published )
881+ {
882+ var ownTopic = customer . Id == topic . CustomerId ;
883+ return ownTopic ;
884+ }
894885 }
895886
896887 return false ;
@@ -903,7 +894,7 @@ public virtual bool IsCustomerAllowedToCreatePost(Customer customer, ForumTopic
903894 return false ;
904895 }
905896
906- if ( customer . IsGuest ( ) && ! _forumSettings . AllowGuestsToCreatePosts )
897+ if ( ! _forumSettings . AllowGuestsToCreatePosts && customer . IsGuest ( ) )
907898 {
908899 return false ;
909900 }
@@ -913,58 +904,39 @@ public virtual bool IsCustomerAllowedToCreatePost(Customer customer, ForumTopic
913904
914905 public virtual bool IsCustomerAllowedToEditPost ( Customer customer , ForumPost post )
915906 {
916- if ( post == null || customer == null || customer . IsGuest ( ) )
917- {
918- return false ;
919- }
920-
921- if ( customer . IsForumModerator ( ) )
907+ if ( post != null && customer != null )
922908 {
923- return true ;
924- }
909+ if ( customer . IsForumModerator ( ) )
910+ {
911+ return true ;
912+ }
925913
926- if ( _forumSettings . AllowCustomersToEditPosts && post . Published )
927- {
928- var ownPost = customer . Id == post . CustomerId ;
929- return ownPost ;
914+ if ( _forumSettings . AllowCustomersToEditPosts && post . Published )
915+ {
916+ var ownPost = customer . Id == post . CustomerId ;
917+ return ownPost ;
918+ }
930919 }
931920
932921 return false ;
933922 }
934923
935924 public virtual bool IsCustomerAllowedToDeletePost ( Customer customer , ForumPost post )
936925 {
937- if ( post == null || customer == null || customer . IsGuest ( ) )
926+ if ( post != null && customer != null )
938927 {
939- return false ;
940- }
941-
942- if ( customer . IsForumModerator ( ) )
943- {
944- return true ;
945- }
946-
947- if ( _forumSettings . AllowCustomersToDeletePosts && post . Published )
948- {
949- var ownPost = customer . Id == post . CustomerId ;
950- return ownPost ;
951- }
952-
953- return false ;
954- }
928+ if ( customer . IsForumModerator ( ) )
929+ {
930+ return true ;
931+ }
955932
956- public virtual bool IsCustomerAllowedToSetTopicPriority ( Customer customer )
957- {
958- if ( customer == null || customer . IsGuest ( ) )
959- {
960- return false ;
933+ if ( _forumSettings . AllowCustomersToDeletePosts && post . Published )
934+ {
935+ var ownPost = customer . Id == post . CustomerId ;
936+ return ownPost ;
937+ }
961938 }
962939
963- if ( customer . IsForumModerator ( ) )
964- {
965- return true ;
966- }
967-
968940 return false ;
969941 }
970942
0 commit comments