コード例 #1
0
ファイル: BlogEntry.cs プロジェクト: smithydll/boxsocial
        public static void NotifyBlogComment(Core core, Job job)
        {
            Comment comment = new Comment(core, job.ItemId);
            BlogEntry ev = new BlogEntry(core, comment.CommentedItemKey.Id);

            if (ev.Owner is User && (!comment.OwnerKey.Equals(ev.OwnerKey)))
            {
                core.CallingApplication.SendNotification(core, comment.User, (User)ev.Owner, ev.OwnerKey, ev.ItemKey, "_COMMENTED_BLOG_POST", comment.BuildUri(ev));
            }

            core.CallingApplication.SendNotification(core, comment.OwnerKey, comment.User, ev.OwnerKey, ev.ItemKey, "_COMMENTED_BLOG_POST", comment.BuildUri(ev));
        }
コード例 #2
0
ファイル: UserGuestBook.cs プロジェクト: smithydll/boxsocial
        public static void NotifyUserComment(Core core, Job job)
        {
            Comment comment = new Comment(core, job.ItemId);
            core.LoadUserProfile(comment.CommentedItemKey.Id);
            User ev = core.PrimitiveCache[comment.CommentedItemKey.Id];

            if (ev.Owner is User && (!comment.OwnerKey.Equals(ev.ItemKey)))
            {
                core.CallingApplication.SendNotification(core, comment.User, (User)ev.Owner, ev.ItemKey, ev.ItemKey, "_COMMENTED_GUEST_BOOK", comment.BuildUri(ev));
            }

            //core.CallingApplication.SendNotification(core, comment.OwnerKey, ev.ItemKey, string.Format("[user]{0}[/user] commented on [user]{2}[/user] [iurl=\"{1}\"]blog post[/iurl]", comment.OwnerKey.Id, comment.BuildUri(ev), ev.OwnerKey.Id), string.Empty, emailTemplate);
        }
コード例 #3
0
ファイル: Comment.cs プロジェクト: smithydll/boxsocial
        public static bool Delete(Core core)
        {
            long commentId = core.Functions.FormLong("id", core.Functions.RequestLong("id", 0));
            Comment comment;

            bool canDelete = false;
            comment = new Comment(core, commentId);

            ICommentableItem item = comment.CommentedItem;

            if (comment.PermissiveParent.Access.Can("DELETE_COMMENTS"))
            {
                canDelete = true;
            }
            else
            {
                throw new PermissionDeniedException("UNAUTHORISED_TO_DELETE_COMMENT");
            }

            if (comment.OwnerKey == core.LoggedInMemberItemKey)
            {
                canDelete = true;
            }

            if (canDelete)
            {
                comment.Delete();
                return true;
            }
            else
            {
                return false;
            }
        }
コード例 #4
0
ファイル: Comment.cs プロジェクト: smithydll/boxsocial
 public CommentPostedEventArgs(Comment comment, User poster, ItemKey itemKey)
 {
     this.comment = comment;
     this.poster = poster;
     this.itemKey = itemKey;
 }
コード例 #5
0
ファイル: GalleryItem.cs プロジェクト: smithydll/boxsocial
        public static void NotifyGalleryItemComment(Core core, Job job)
        {
            try {
                Comment comment = new Comment(core, job.ItemId);
                GalleryItem ev = new GalleryItem(core, comment.CommentedItemKey.Id);

                if (ev.Owner is User && (!comment.OwnerKey.Equals(ev.OwnerKey)))
                {
                    core.CallingApplication.SendNotification(core, comment.User, (User)ev.Owner, ev.OwnerKey, ev.ItemKey, "_COMMENTED_GALLERY_ITEM", comment.BuildUri(ev));
                }

                core.CallingApplication.SendNotification(core, comment.OwnerKey, comment.User, ev.OwnerKey, ev.ItemKey, "_COMMENTED_GALLERY_ITEM", comment.BuildUri(ev));
            }
            catch (InvalidCommentException)
            {
            }
            catch (GalleryItemNotFoundException)
            {

            }
        }