Tahinli/forge
public0 watching
★ 0
| 1 | //! Discussion types: a per-repo forum next to issues. Storage lives in `store/discussions.rs`. |
| 2 | //! Titles and bodies are checked with the issue validators, since the limits are the same. |
| 3 | |
| 4 | use crate; |
| 5 | |
| 6 | /// Categories a discussion can be filed under. The `as_str` names are stored. |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | /// Every category, in the order the chooser shows them. |
| 17 | pub const DISCUSSION_CATEGORIES: & = & |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | ; |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | /// One discussion. `answer_comment_id` is set only in Q&A, and names the accepted reply. |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | /// A discussion with its author's username, for the list. |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | /// Why a discussion is in a user's inbox. The `as_str` names are stored in `discussion_notifications`. |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | /// One inbox row for a discussion, joined with its repo and title for the notifications page. |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | /// One comment. A top-level comment has no `parent_id`; a reply names a top-level comment of the |
| 123 | /// same discussion. A deleted comment has `deleted` set and an empty body. |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | /// Filters and paging for the discussion list. `category: None` lists every category. |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | /// Validates a discussion title (trimmed, returned) and body. |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | /// Validates a comment body: not blank, and within the body limit. |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 |