Commit cde0194
committed
test(moderators): Cover the owner promotion preconditions
The rules deciding whether ownership can be handed over were private helpers in
the Compose sheet, so nothing tested them. They are the kind of thing that rots
quietly: a conversation type added to one of the sets, or a precondition the
server tightens, changes who sees a destructive action with nothing to catch it.
Move them to ParticipantRoleUtils, next to roleOf(), and test them there.
canChangeOwnership() is the gate; canBePromotedToOwner() and
canBeDemotedFromOwner() add the target's own rank. The sheet keeps only the
question of which row to draw.
The tests walk each dimension of the matrix rather than sampling it, so a new
conversation or object type has to be classified deliberately instead of
inheriting whatever the enum ordering gives it: every rankless conversation
type, every object type with an implicit owner, every actor type that can never
hold the rank, and every participant rank on both sides of promotable.
Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>1 parent 17671f4 commit cde0194
3 files changed
Lines changed: 298 additions & 44 deletions
File tree
- app/src
- main/java/com/nextcloud/talk
- conversationinfo/ui
- utils
- test/java/com/nextcloud/talk/utils
Lines changed: 9 additions & 44 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
52 | 50 | | |
53 | 51 | | |
54 | 52 | | |
| |||
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | 64 | | |
98 | 65 | | |
99 | 66 | | |
| |||
104 | 71 | | |
105 | 72 | | |
106 | 73 | | |
107 | | - | |
| 74 | + | |
108 | 75 | | |
109 | 76 | | |
110 | 77 | | |
| |||
114 | 81 | | |
115 | 82 | | |
116 | 83 | | |
117 | | - | |
| 84 | + | |
118 | 85 | | |
119 | 86 | | |
120 | 87 | | |
| |||
149 | 116 | | |
150 | 117 | | |
151 | 118 | | |
152 | | - | |
153 | | - | |
| 119 | + | |
| 120 | + | |
154 | 121 | | |
155 | 122 | | |
156 | 123 | | |
| |||
161 | 128 | | |
162 | 129 | | |
163 | 130 | | |
164 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
165 | 136 | | |
166 | 137 | | |
167 | 138 | | |
| |||
170 | 141 | | |
171 | 142 | | |
172 | 143 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | 144 | | |
180 | 145 | | |
181 | 146 | | |
| |||
Lines changed: 67 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 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 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
69 | 136 | | |
0 commit comments