Пример #1
0
 private void NotifyCommentCreated(Page page, Comment comment)
 {
     WikiNotifyClient.SendNoticeAsync(
         SecurityContext.CurrentAccount.ID.ToString(),
         Constants.EditPage,
         PageNameUtil.Encode(page.PageName),
         null,
         GetNotifyTags(page.PageName, "new wiki page comment", comment));
     WikiActivityPublisher.AddPageComment(page, comment);
 }
Пример #2
0
 private void NotifyPageEdited(Page page)
 {
     WikiNotifyClient.SendNoticeAsync(
         SecurityContext.CurrentAccount.ID.ToString(),
         Constants.EditPage,
         PageNameUtil.Encode(page.PageName),
         null,
         GetNotifyTags(page.PageName, "edit wiki page", null));
     WikiActivityPublisher.EditPage(page);
 }
Пример #3
0
 private void NotifyPageCreated(Page page)
 {
     WikiNotifyClient.SendNoticeAsync(
         SecurityContext.CurrentAccount.ID.ToString(),
         Constants.NewPage,
         null,
         null,
         GetNotifyTags(page.PageName));
     WikiActivityPublisher.AddPage(page);
 }
Пример #4
0
        /// <summary>
        /// Updates comment by setting inactive flag to 1
        /// </summary>
        /// <param name="id">comment id</param>
        public void DeleteComment(Guid id)
        {
            var comment = GetComment(id);
            var page    = GetPage(comment.PageName);

            comment.Inactive = true;
            comment.Date     = DateTime.UtcNow;
            comment.UserId   = SecurityContext.CurrentAccount.ID;

            SaveComment(comment);
            WikiActivityPublisher.DeletePageComment(page, comment);
        }
Пример #5
0
        public File SaveFile(File file)
        {
            using (var dao = GetFileDAO())
            {
                var saved = dao.SaveFile(file);

                if (saved != null)
                {
                    WikiActivityPublisher.AddFile(file);
                }

                return(saved);
            }
        }
Пример #6
0
        protected void cmdRevert_Click(object sender, EventArgs e)
        {
            int ver;

            if (int.TryParse((sender as LinkButton).CommandName, out ver))
            {
                var page = Wiki.GetPage(PageNameUtil.Decode(WikiPage), ver);
                if (page != null)
                {
                    page.Date    = TenantUtil.DateTimeNow();
                    page.UserID  = SecurityContext.CurrentAccount.ID;
                    page.Version = Wiki.GetPageMaxVersion(page.PageName) + 1;

                    Wiki.SavePage(page);
                    Wiki.UpdateCategoriesByPageContent(page);

                    WikiActivityPublisher.RevertPage(page);
                    BindHistoryList();
                }
            }
        }
Пример #7
0
        public Comment UpdateComment(Comment comment)
        {
            var toUpdate = GetComment(comment.Id);

            if (toUpdate == null)
            {
                throw new ItemNotFoundException("comment not found");
            }
            if (String.IsNullOrEmpty(comment.Body))
            {
                throw new ArgumentException(@"comment content cannot be empty", "comment");
            }

            toUpdate.Body   = comment.Body;
            toUpdate.UserId = SecurityContext.CurrentAccount.ID;
            toUpdate.Date   = DateTime.UtcNow;

            var page = GetPage(comment.PageName);

            WikiActivityPublisher.EditPageComment(page, comment);

            return(SaveComment(comment));
        }