Closed (fixed)
Project:
Simplenews
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 Dec 2011 at 13:19 UTC
Updated:
30 Jan 2012 at 07:10 UTC
Jump to comment: Most recent file
From #1038160: Cleanup object / array entity CRUD code:
The main thing that I noticed are some duplicating/overlapping/confusingly named functions. Two examples:
simplenews_get_subscription($acount): Doesn't return a *subscription* but a subscriber object. Should probably be renamed to _get_subscriber, or better, _load_subscriber_by_account(), which is similar to e.g. user_load_by_mail() and so on.
simplenews_get_mailing_lists($show_all) is a wrapper of simplenews_categories_load_multiple() with either the hidden condition set or not.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | simplenews_category_get_visible.patch | 6.16 KB | berdir |
| #9 | fixed_the_tests.patch | 6.17 KB | berdir |
| #7 | re-roll.patch | 6.63 KB | berdir |
| #3 | rename_categories.patch | 7.42 KB | berdir |
Comments
Comment #1
berdirMore:
simplenews_category_load()/list(), but simplenews_categories_load_multiple(). Should all be category, it's node_load_multiple(), not nodes_load_multiple().
Actually, category itself is kinda wrong, but that's probably too much of a change right now. Because simplenews_newsletter_*() already exists, but that's actually about newsletter issues..
Comment #2
miro_dietikerAt least, we should unify the unclean plural+singular namings.
Comment #3
berdirYes.
The get_subscription() function has it's own issue now.
I am not sure what we should rename get_mailing_lists() to but the name is clearly misleading. Maybe simplenews_get_public_categories() or something like that because we only need to cover the $show_all = FALSE case.. the other one is already covered by simplenews_category_load_multiple() directly...
Comment #4
berdir#3: rename_categories.patch queued for re-testing.
Comment #6
berdirRenamed simplenews_get_mailing_lists() to simplenews_get_visible_categories(), I think that's kinda fine.
Other than that, just a re-roll.
Comment #7
berdirAnd now with a patch.
Comment #9
berdirFixed the test fails.
Comment #10
miro_dietikerAs discussed, i prefer having
simplenews_category as a common prefix for all category related functions.
So please update
simplenews_get_visible_categories() => simplenews_category_get_visible()
This allows better alphanumeric grouping in IDEs and provides better readability (at least for me ;-) ).
Comment #11
berdirMakes perfect sense, updated.
Will commit this tomorrow in the train or so...
Comment #12
miro_dietikerLooks fine to me.
Comment #13
berdirCommited.