Commit d3b49ff
committed
Introduced new
Previously, there was an `IsDirty()` method that accepted an attribute key (`name`) to check the status of an individual attribute. In most use cases, though, it makes more sense to check the entire `AttributeValueCollection` to see if there are _any_ dirty attributes, as that's a condition that will determine if the topic itself should be saved. To support this, a new overload is introduced which, absent any parameters, will return true of any `AttribtueValue`s stored in it are marked as `IsDirty`.
In addition, however, this presents an opportunity to centralize logic for identifying extraneous byline (`LastModifiedBy`) and dateline (`LastModified`) attributes. These attribute values are automatically and dynamically generated by some clients, such as the **OnTopic Editor**. As a result, if you save a topic five times without making any changes, you'll end up with five versions due to the `DateModified` being automatically updated. To help address that in a centralized fashion, the `IsDirty()` method also accepts an `excludeLastModified` parameter which will only report `true` if there are `AttributeValue`s marked as `IsDirty` whose `Key`s don't start with `LastModified`. This provides a useful condition for excluding extraneous updates—and, therefore, "orphaned" versions.
This supports Remove byline and dateline if no other attributes are updated (#20).IsDirty() overloads for AttributeValueCollection
1 parent 8b7dffe commit d3b49ff
File tree
2 files changed
+86
-2
lines changed- OnTopic.Tests
- OnTopic/Collections
2 files changed
+86
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
251 | 252 | | |
252 | 253 | | |
253 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
254 | 314 | | |
255 | 315 | | |
256 | 316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
57 | 80 | | |
58 | 81 | | |
59 | 82 | | |
60 | 83 | | |
61 | 84 | | |
62 | 85 | | |
63 | | - | |
64 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
65 | 89 | | |
66 | 90 | | |
67 | 91 | | |
| |||
0 commit comments