Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retire blog.isWPcom #3725

Merged
merged 35 commits into from
Jun 1, 2015
Merged

Retire blog.isWPcom #3725

merged 35 commits into from
Jun 1, 2015

Conversation

koke
Copy link
Member

@koke koke commented May 27, 2015

blog.isWPcom was usually not the right question.

Now there's blog. isHostedAtWPcom to check if a blog is really hosted at WordPress.com, but most checks are done with [blog supports:feature]

There's a more detailed list of all the checks that changed in #3700

@jleandroperez I limited push notification support to the default account, since I don't think it'll work if a Jetpack site is connected to a different account: NotificationsManager only uses the default account, and the toggle push notifications switch on site settings won't find non-default blog IDs on the notification_preferences dictionary.

@astralbodies are you the guardian of new data models? Because there's a new one 💂‍♂️

@aerych reader views seem to behave fine, and comment likes, reblogs,... seem to be allowed when they need to (except #3724)

Fixes #3700
Needs Review: @jleandroperez @astralbodies @aerych

koke added 30 commits May 21, 2015 01:28
Uses BlogFeatureVisibility to check if a blog can be hidden.
I had to duplicate some logic due to SQLite-backed core data not being
compatible with block predicates.
I added some cross-comments about this hoping that it won't break in the
future.
Logic was reversed
In #3635 we switched to a unique list for all the sites in the app.
Update the blog selector to match that
Also, it uses the primary blog first if there is one

Fixes #2599
Created some helper methods to reuse fetch request and predicate
creation
Only supported if the associated wp.com account is the defatult
I think that, in theory, this should work with Jetpack sites as well,
but:
1. I'm not sure if stats notifications are generated for Jetpack sites
2. The call to -[BlogService blogByBlogId:] won't find the right site
for non-REST Jetpack sites, as blogID will contain the self hosted ID.
We are already checking supports:BlogFeatureStats, there's no need to
check isWPcom
Since a blog can belong to a wp.com account but be hosted somewhere
else, store the `jetpack` value from REST into `blog.isJetpack` so we
can properly implement `isHostedAtWPcom`.
For accuracy and ugliness!
@koke
Copy link
Member Author

koke commented May 27, 2015

I noticed this one has #3704 merged in, so ignore the changes in BlogSelectorViewController.m for now

@astralbodies
Copy link
Contributor

Core Data changes look good!

@@ -8,6 +8,29 @@
@class WPAccount;
@class WordPressComApi;

typedef NS_ENUM(NSUInteger, BlogFeature) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@jleandroperez
Copy link
Contributor

Notifications changes look good!. :shipit: on my side!

NSMutableArray *mButtons = [NSMutableArray arrayWithObjects:self.metaButtonLeft, self.metaButtonRight, nil];
if ([self.contentProvider numberOfComments] > 0) {
if ([self.contentProvider supportsComments] && [self.contentProvider numberOfComments] > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what's gained by adding the supportsComments and supportsLikes checks since the count would just be 0 if not supported.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could say the same about the previous isWPcom check 😉
I don't know, they're probably not necessary, but it seemed good to add the explicit check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 maybe? Seems like its just adding noise if there is no real purpose. If the next dev who comes along would wonder why both checks were being made maybe we don't need it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped in 77b4fad
\o/ for less code 😄

@aerych
Copy link
Member

aerych commented Jun 1, 2015

:shipit: from me as well :)

Conflicts:
	WordPress/Classes/Models/Blog.h
	WordPress/Classes/ViewRelated/Blog/EditSiteViewController.m
koke added a commit that referenced this pull request Jun 1, 2015
@koke koke merged commit 54c666a into develop Jun 1, 2015
@koke koke deleted the issue/3700-fix-iswpcom branch June 1, 2015 18:01
@jleandroperez
Copy link
Contributor

YAY!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When Jetpack REST is enabled, isWPcom isn't accurate anymore
5 participants