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

Facebook Publicize disable selection of profiles #8115

Merged
merged 37 commits into from Jul 31, 2018

Conversation

kwonye
Copy link
Contributor

@kwonye kwonye commented Jul 30, 2018

Fixes #7591 & #8026

We're no longer allowing users to add their profiles to publicize. Also, this adds pages to the selection list where people can connect to.

To test:

  1. Add a facebook account with a page. Only the page will be shown in the selection dialog. No profiles.
  2. Add a facebook account with no pages. It will error out.
  3. See the facebook detail item and notice the new user message about the changes August 1st.

screenshot_20180729-195923

@loremattei we're going to make a 10.5.1 to release this by August 1. Feel free to ship 10.5 without this tomorrow, thanks!

@kwonye kwonye added this to the 10.5 ❄️ milestone Jul 30, 2018
@kwonye kwonye self-assigned this Jul 30, 2018
@kwonye kwonye requested review from loremattei and mzorz July 30, 2018 03:01
Copy link
Contributor

@mzorz mzorz left a comment

Choose a reason for hiding this comment

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

Thanks for this @kwonye , I left a comment and a question, will start testing now

private String getName(PublicizeConnection connection) {
String name = connection.getExternalDisplayName();

if (name.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use TextUtils.isEmpty(name) here so we also have null as a possibility

}
}

return totalAccounts > 0;
if (PublicizeTable.onlyExternalConnections(serviceId)) {
return totalAccounts > 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be return totalExternalAccounts > 0?

@mzorz
Copy link
Contributor

mzorz commented Jul 30, 2018

I've tried upgrading from a fresh install of tag 10.4 to current branch release/10.5, and then instaling this branch (fix/facebook-publicize-aug-1) and the app crashes with this log:

07-30 10:31:09.046 8793-8793/org.wordpress.android I/WordPress-UTILS: WordPress.onCreate
07-30 10:31:09.058 8793-8793/org.wordpress.android E/SQLiteLog: (1) table people_team already exists
07-30 10:31:09.061 8793-8793/org.wordpress.android E/WordPress-DB: table people_team already exists (code 1): , while compiling: CREATE TABLE people_team (person_id INTEGER DEFAULT 0,local_blog_id INTEGER DEFAULT 0,user_name TEXT,display_name TEXT,avatar_url TEXT,role TEXT,PRIMARY KEY (person_id, local_blog_id));
    android.database.sqlite.SQLiteException: table people_team already exists (code 1): , while compiling: CREATE TABLE people_team (person_id INTEGER DEFAULT 0,local_blog_id INTEGER DEFAULT 0,user_name TEXT,display_name TEXT,avatar_url TEXT,role TEXT,PRIMARY KEY (person_id, local_blog_id));
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:890)
        at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:501)
        at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
        at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
        at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
        at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1752)
        at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1682)
        at org.wordpress.android.datasets.PeopleTable.createTables(PeopleTable.java:33)
        at org.wordpress.android.WordPressDB.<init>(WordPressDB.java:119)
        at org.wordpress.android.WordPress.createAndVerifyWpDb(WordPress.java:434)
        at org.wordpress.android.WordPress.initWpDb(WordPress.java:424)
        at org.wordpress.android.WordPress.onCreate(WordPress.java:252)
        at org.wordpress.android.WordPressDebug.onCreate(WordPressDebug.java:14)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
07-30 10:31:09.062 8793-8798/org.wordpress.android I/zygote64: Do partial code cache collection, code=59KB, data=41KB
07-30 10:31:09.062 8793-8793/org.wordpress.android E/WordPress-DB: Invalid database, sign out user and delete database
07-30 10:31:09.063 8793-8798/org.wordpress.android I/zygote64: After code cache collection, code=59KB, data=41KB
    Increasing code cache capacity to 256KB
07-30 10:31:09.131 2030-2040/? I/zygote64: Background concurrent copying GC freed 168260(6MB) AllocSpace objects, 30(1732KB) LOS objects, 50% free, 14MB/29MB, paused 97us total 114.607ms
07-30 10:31:09.191 8793-8793/org.wordpress.android I/WordPress-PEOPLE: resetting people table
07-30 10:31:09.399 8793-8793/org.wordpress.android E/SQLiteLog: (1) no such table: tbl_publicize_services
07-30 10:31:09.400 8793-8793/org.wordpress.android D/AndroidRuntime: Shutting down VM
07-30 10:31:09.401 8793-8793/org.wordpress.android E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.wordpress.android, PID: 8793
    java.lang.RuntimeException: Unable to create application org.wordpress.android.WordPressDebug: android.database.sqlite.SQLiteException: no such table: tbl_publicize_services (code 1): , while compiling: alter table tbl_publicize_services add is_external_users_only BOOLEAN;
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: android.database.sqlite.SQLiteException: no such table: tbl_publicize_services (code 1): , while compiling: alter table tbl_publicize_services add is_external_users_only BOOLEAN;
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:890)
        at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:501)
        at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
        at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
        at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
        at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1752)
        at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1682)
        at org.wordpress.android.WordPressDB.<init>(WordPressDB.java:176)
        at org.wordpress.android.WordPress.initWpDb(WordPress.java:428)
        at org.wordpress.android.WordPress.onCreate(WordPress.java:252)
        at org.wordpress.android.WordPressDebug.onCreate(WordPressDebug.java:14)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
        at android.app.ActivityThread.-wrap1(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
07-30 10:31:09.405 867-2234/? W/ActivityManager:   Force finishing activity org.wordpress.android/.ui.WPLaunchActivity

@@ -170,6 +171,9 @@ public WordPressDB(Context ctx) {
case 64:
// add site icon
mDb.execSQL(SiteSettingsModel.ADD_SITE_ICON);
case 65:
// add external users only to publicize services table
mDb.execSQL(PublicizeTable.ADD_EXTERNAL_USERS_ONLY);
Copy link
Contributor

Choose a reason for hiding this comment

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

This crashes when there is no pre-existent PublicizeTable. Apparently, it is only created when PublicizeListActivity is first visited here . We should add a check that the table exists before creating it, or force creating it before this step execution by calling PublicizeTable.createTables(mDb); right above this ALTER TABLE statement.

@mzorz
Copy link
Contributor

mzorz commented Jul 30, 2018

As discussed over Slack, feel free to merge after the crash is taken care of @kwonye 👍

@mzorz
Copy link
Contributor

mzorz commented Jul 31, 2018

Tested! LGTM :shipit:

@mzorz mzorz merged commit f811294 into 10.5.1-rc-1 Jul 31, 2018
@mzorz mzorz deleted the fix/facebook-publicize-aug-1 branch July 31, 2018 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants