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

Unable to Re-enable Twitter Channel After Disabling #437

Closed
1 task done
omarherri opened this issue Nov 17, 2024 · 6 comments
Closed
1 task done

Unable to Re-enable Twitter Channel After Disabling #437

omarherri opened this issue Nov 17, 2024 · 6 comments

Comments

@omarherri
Copy link

📜 Description

Once a Twitter channel is disabled in Postiz, there is no way to re-enable it. No error messages are shown when attempting to re-enable

👟 Reproduction steps

  1. Navigate to channel management/settings
  2. Disable an active Twitter channel
  3. Attempt to re-enable the same Twitter channel

👍 Expected behavior

  • Should be able to re-enable a previously disabled Twitter channel
  • The enable/disable functionality should be toggleable

👎 Actual Behavior with Screenshots

image

💻 Operating system

Linux

🤖 Node Version

Docker

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

Are you willing to submit PR?

None

@AyendiSimeon1
Copy link

Hello @DerLeole , I find it as an interesting issue to work on. I would like to work on this issue. Please assign this issue to me.
/assign

@piffio
Copy link

piffio commented Nov 26, 2024

The same happens with BluySky btw, I believe there is just no way to re-enable a service that has been disabled

@piffio
Copy link

piffio commented Nov 29, 2024

FYI, a workaround is to access the DB and manually enable the integration again, with something like:

update public."Integration" set disabled = false where disabled = true;

@jamesread
Copy link
Collaborator

Hey all, so I looked into this, and it actually happens with any integration. There is a menu option and code to re-renable integrations, but the code is checking how many integrations you are allowed on your "plan", as it has to do this on the paid-version. In the free version, I think the code is making the assumption you have a plan with 0 allowed integrations.

I will continue trying to look at this, and I'll submit a fix if I can, but I probably can't merge that kind of fix until @nevo-david confirms that he's happy with that fix - I don't want to break the paid verison of Postiz.

@jamesread
Copy link
Collaborator

Okay! I found it. This took a bunch of searching through the source code.

When assigning the user's tier (and therefore "totalChannels"), Postiz checks if STRIPE_PUBLISHABLE_KEY is set (stripe is a billing API, so, not used in the self-hosted version). Because it isn't set, it set's the user's tier to ULTIMATE, as found in this line of code;

tier: organization?.subscription?.subscriptionTier || (!process.env.STRIPE_PUBLISHABLE_KEY ? 'ULTIMATE' : 'FREE'),

However, when looking at the database, the "Subscriptions" table is empty - there is no "ULTIMATE" plan, so getting the subscription means that null values are used, or in the case of totalSubscriptions, which is a number, 0 is returned.

We can see this check taking place here;

I just added a subscription into the database manually for my organization ID, and that fixes the problem - I can then enable channels again!

insert into "Subscription" ("organizationId", id, "subscriptionTier", "period", "totalChannels", "updatedAt") VALUES ('77598a36-4bb1-4f50-98e0-80c96442a380', gen_random_uuid(), 'ULTIMATE', 'MONTHLY', 999, now());

So, there are a few possible fixes

  1. Allow SUPERUSER to change Subscription by visiting /billing, and just don't charge. This is the cleanest solution.
  2. Add an ultimate tier when setting up Postiz for the first time - probably not easy to do, and does not fix this for existing users.
  3. If the subscription isn't found, return a fake ULTIMATE subscription.

@jamesread
Copy link
Collaborator

Fixed in f4a4d8a :-)

Please update to the latest version of Postiz to fix this.

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

No branches or pull requests

4 participants