예제 #1
0
		public static Thread.MakerReturn CreateNewThreadInGroup(int groupK, IDiscussable discussable, Guid duplicateGuid, string commentHtml, bool isNews, List<int> invitedUsrKs, bool isPrivate)
		{
			Group g = new Group(groupK);
			GroupUsr gu = g.GetGroupUsr(Usr.Current);
			if (!g.CanMember(Usr.Current, gu))
				throw new DsiUserFriendlyException("You can't post to this group!");

			Thread.Maker m = new Thread.Maker();
			m.PostingUsr = Usr.Current;
			m.Body = commentHtml;

			string stripped = Cambro.Web.Helpers.StripHtmlDoubleSpacesLineFeeds(m.Body);
			if (stripped.Trim().Length == 0)
				stripped = "[no subject]";

			m.Subject = ((stripped.Length > 50) ? (stripped.Substring(0, 47) + "...") : stripped);

			m.ParentType = discussable.ObjectType;
			m.ParentK = discussable.K;
			m.DuplicateGuid = duplicateGuid;
			m.Private = isPrivate;

			if (isNews)
				m.News = true;

			m.InviteKs = invitedUsrKs;
			m.GroupK = g.K;

			Thread.MakerReturn r = m.Post();
			return r;
		}