privatethread.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. from django.core.urlresolvers import reverse
  2. from django.utils.translation import ugettext_lazy as _
  3. from misago.threads.threadtypes import ThreadTypeBase
  4. class PrivateThread(ThreadTypeBase):
  5. type_name = 'private_threads'
  6. def get_forum_name(self, forum):
  7. return _('Private Threads')
  8. def get_forum_absolute_url(self, forum):
  9. return reverse('misago:private_threads')
  10. def get_new_thread_url(self, forum):
  11. return reverse('misago:private_thread_new')
  12. def get_reply_url(self, thread):
  13. return reverse('misago:reply_private_thread', kwargs={
  14. 'thread_id': thread.id,
  15. })
  16. def get_edit_post_url(self, post):
  17. return reverse('misago:edit_private_post', kwargs={
  18. 'forum_id': post.forum_id,
  19. 'thread_id': post.thread_id,
  20. 'post_id': post.id
  21. })
  22. def get_thread_absolute_url(self, thread):
  23. return reverse('misago:private_thread', kwargs={
  24. 'thread_slug': thread.slug,
  25. 'thread_id': thread.id
  26. })
  27. def get_thread_post_url(self, thread, post_id, page):
  28. kwargs = {
  29. 'thread_slug': thread.slug,
  30. 'thread_id': thread.id,
  31. }
  32. if page > 1:
  33. kwargs['page'] = page
  34. url = reverse('misago:private_thread', kwargs=kwargs)
  35. return '%s#post-%s' % (url, post_id)
  36. def get_thread_last_reply_url(self, thread):
  37. return reverse('misago:private_thread_last', kwargs={
  38. 'thread_slug': thread.slug,
  39. 'thread_id': thread.id
  40. })
  41. def get_thread_new_reply_url(self, thread):
  42. return reverse('misago:private_thread_new', kwargs={
  43. 'thread_slug': thread.slug,
  44. 'thread_id': thread.id
  45. })
  46. def get_thread_moderated_url(self, thread):
  47. return reverse('misago:private_thread_moderated', kwargs={
  48. 'thread_slug': thread.slug,
  49. 'thread_id': thread.id
  50. })
  51. def get_thread_reported_url(self, thread):
  52. return reverse('misago:private_thread_reported', kwargs={
  53. 'thread_slug': thread.slug,
  54. 'thread_id': thread.id
  55. })
  56. def get_post_absolute_url(self, post):
  57. return reverse('misago:private_thread_post', kwargs={
  58. 'thread_slug': post.thread.slug,
  59. 'thread_id': post.thread.id,
  60. 'post_id': post.id
  61. })
  62. def get_post_quote_url(self, post):
  63. return reverse('misago:quote_private_post', kwargs={
  64. 'post_id': post.id
  65. })
  66. def get_post_unhide_url(self, post):
  67. return reverse('misago:unhide_private_post', kwargs={
  68. 'post_id': post.id
  69. })
  70. def get_post_hide_url(self, post):
  71. return reverse('misago:hide_private_post', kwargs={
  72. 'post_id': post.id
  73. })
  74. def get_post_delete_url(self, post):
  75. return reverse('misago:delete_private_post', kwargs={
  76. 'post_id': post.id
  77. })
  78. def get_post_report_url(self, post):
  79. return reverse('misago:report_private_post', kwargs={
  80. 'post_id': post.id
  81. })
  82. def get_event_edit_url(self, event):
  83. return reverse('misago:edit_private_event', kwargs={
  84. 'event_id': event.id
  85. })