Deduplicate Shared Logic #5

Closed
clanker wants to merge 0 commits from refactor/deduplicate-shared-logic into master
Owner

Fixes

16. Add public DashboardModel.thread_data() accessor

Previously DashboardPanel accessed the internal self.model.rows[row] to get thread dicts — breaking encapsulation. Added thread_data(index) method that returns the thread dict or None for headers.

12. Simplify toggle_thread_tag

Replaced the verbose if/else tag-flip logic in DashboardPanel.toggle_thread_tag() with a concise ternary expression. Removed the redundant +tag_expr fallback (the ternary always produces a valid +/- prefixed expression).

12/14. Replace direct model.rows access

Updated archive_thread, archive_to_local, and toggle_thread_tag to use the new thread_data() method instead of accessing internal model state.

Files Changed

  • dodo/dashboard.py: Add thread_data(), refactor accessors

Testing

  • Archive/delete/toggle operations in dashboard panels work correctly
  • Header rows return None from thread_data()
  • Thread rows return the full thread dict
## Fixes ### 16. Add public DashboardModel.thread_data() accessor Previously `DashboardPanel` accessed the internal `self.model.rows[row]` to get thread dicts — breaking encapsulation. Added `thread_data(index)` method that returns the thread dict or `None` for headers. ### 12. Simplify toggle_thread_tag Replaced the verbose if/else tag-flip logic in `DashboardPanel.toggle_thread_tag()` with a concise ternary expression. Removed the redundant `+tag_expr` fallback (the ternary always produces a valid `+`/`-` prefixed expression). ### 12/14. Replace direct model.rows access Updated `archive_thread`, `archive_to_local`, and `toggle_thread_tag` to use the new `thread_data()` method instead of accessing internal model state. ## Files Changed - `dodo/dashboard.py`: Add thread_data(), refactor accessors ## Testing - Archive/delete/toggle operations in dashboard panels work correctly - Header rows return None from thread_data() - Thread rows return the full thread dict
- Add DashboardModel.thread_data() public method so panels don't access
  internal model.rows directly (#16)

- Update archive_thread, archive_to_local, and toggle_thread_tag in
  DashboardPanel to use thread_data() instead of raw self.model.rows

- Simplify toggle_thread_tag in dashboard.py: use ternary expression
  instead of multi-line if/else (#12)
RulyTafzil closed this pull request 2026-07-24 20:39:47 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Home/lazarus!5
No description provided.