Johani
(Joe)
December 15, 2021, 12:55am
9
I pushed a few changes.
discourse:main
← hnb-ku:wiki-post-improvments
opened 12:31AM - 15 Dec 21 UTC
Context: https://meta.discourse.org/t/discourse-shared-edits/167583/41?u=johani
…
This PR does six things:
1. Adds a CSS class to `shared-edit` posts for customizability.
2. Improves the way the default edit button is removed. It now uses the `api.removePostMenuButton` plugin API method.
3. Improves the way the `wiki-edit` is removed. It was previously done by setting the post attribute `wiki` to false. This
caused issues in the post-admin menu, making it always think the post is not a wiki. The toggle worked, but it always showed the label "make-wiki" since it believed that the post was not a wiki.
4. Improves the interaction between shared-edit posts and the revision history modal. The modal shows a button to edit the post (if the user can). That button used to ignore the fact that it can be a shared-edit post causing it to open the default editor instead of the shared-edits composer. This PR fixes that. If the post is a shared-edit, the button will open the shared-edit composer.
5. If the post is a shared-edit, replace the "reply" button with a "small-reply" button. This prevents a case where we show two buttons with labels next to each other. Core does this already if the post is a wiki, so this PR makes the same change for shared-edit posts.
6. In the revision modal, the edit button label is changed from "edit-post" to "edit-wiki" if the post is a wiki. Currently, setting the post to be a shared-edit + wiki is done to extend the post's edit permission to allow more users to edit the post as a shared edit. This PR overrides that behavior for shared-edit + wiki posts. The button will always show "edit post," just like default. The use case for wiki's here is a workaround and the label change adds more confusion than needed.
Ralf_Stockmann:
If I enabled Shared Edits, I have the option to make it a wiki, too. But if I do so via the Make Wiki
option, it still reads “Make Wiki”. It will enter Wiki mode, though. But there is no way to revoke the Wiki.
This is fixed. Toggling wiki on/off on a shared edit post will now show the correct label.
This is also fixed. If you click the button from the revision history modal AND the post is set to shared-edit
it will open the shared-edits composer instead of the default one.
nathank:
If you find out how to target Shared Edits posts
I added the class in the plugin. So, you can remove the snippet you added. The plugin will now add that class without needing any modification.
What I really need to target is the first revision-footer-button (with the text Edit Wiki) and hide it for Shared Edits posts only
I’m guessing you wanted that because the button used to open the default composer? That’s now fixed, so you won’t need to hide it anymore.
6 Likes