Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR brings two big changes.
1. Introducing
Social.set
Takes
data
object and commits it to SocialDB. It works similarly to theCommitButton
by spawning the modal window prompt to save data, but it doesn't have to be triggered through the commit button component. It allows you to write more flexible code that relies on async promises and use other events and components. Overall it enables more flexibility when committing to SocialDB. For example, you can commit when Enter key pressed.Arguments:
data
required, the data object to be committed. Similar toCommitButton
, it shouldn't start with account ID.options
optional objectforce
, whether to overwrite the dataonCommit
- function to trigger on successful commit. Will pass the data that was written (including accountID)onCancel
- function to trigger if the user cancels the commit.2. Ability to skip confirmation.
When a modal window to confirm a commit is shown, it has a toggle to select whether you want to confirm the action every time, or don't show the confirm window for the similar data. By default for the new data, the toggle is set to on, which means the user will not be prompted to confirm the data for the next time. It remembers the decision locally and will be default to this decision next time (in case the user decides to not skip). If user approves the commit with the toggle on, then the next commit with the similar data will skip the confirmation window. The permission is given per widget src.
Similar data means, the same top level keys on the data. Except for the 4 top level keys:
graph
,post
,index
andsettings
. For these keys, the second level key will be used. More keys can be added later, once new standards added.For example the follow button widget uses the following keys:
If it attempts to modify something else, the confirmation modal will be shown again.
Example
Example on using
CommitButton
andSocial.set
with regular button. Note, both useforce