How to create a "follow" / "unfollow" button?

I am stuck with a problem. I would like to allow some users to “follow” other users, like in when a reader follows an author to get notified of the author’s new articles. The problem I have is simple: how to do that with an Action Button in Tadabase? Or is there another way?

First, assuming this is with an action button, I don’t know how to test a condition that is based on a logged in user field. Here the condition would be: if the user already follows the author (i.e. is connected), then the text of the button should be replaced by “Following” and the action (create a connection) should be disabled.

Assuming the connections are modeled with a “Connections” table with 2 fields: a connection to the authors table, a connection to the readers table, then “following” means adding a record to the table (author’s page user + logged in user). The problem is the “unfollowing” part.

How to delete a connection with a simple click of an action button, without having to display a table with ALL the connections?

How to allow a single connection (and no duplicate connections) between two users?

I have done something similar to this but I have used 2 action buttons, in your case one called Follow and one called Unfollow and then you can use the display rules in the table cell to show the appropriate button.

Here is the follow action button display rules:

Here is the follow action rules:

Here is the unfollow display rules:

Here is the unfollow action rules: