FriendsOfFlarum / byobu

Well integrated, advanced private discussions for your Flarum forum.
https://discuss.flarum.org/d/4762-flagrow-by-bu-well-integrated-advanced-private-discussions
MIT License
54 stars 33 forks source link

Forcing to single tag can create a dead end with incompatible Tag settings #107

Closed jordanjay29 closed 4 years ago

jordanjay29 commented 4 years ago

When Byobu settings force all new PDs to a selected tag slug, that tag slug must be 100% compatible with the current Tag settings. This removes the ability for PDs to be put in tags that do not obey the traditional structure if desired.

For example: Flarum's default Tag settings require 1 Primary tag and 0-3 Secondary tags.
If Byobu's forced tag slug is set to a Secondary tag, no further PDs can open.

Byobu either needs the ability to sidestep the Tag settings, or ideally, to allow multiple tag slugs to be used when opening a new PD to make them compatible with Tag settings.

davwheat commented 4 years ago

Currently only primary tags are supported in the options. Was this a workaround to prevent people having this issue or is it now intended? @imorland

imorland commented 4 years ago

It's a slightly more elegant workaround until https://github.com/flarum/core/issues/2138 is implemented

davwheat commented 4 years ago

Would it be worth allowing secondary tags to be chosen, and then automatically add the required primary tag when creating the PD?

I was thinking something like this:

https://github.com/FriendsOfFlarum/byobu/blob/9dec307ea855f62be48a4888a18ccbd3b9100014/js/src/forum/components/PrivateDiscussionComposer.js#L40

would become...

if (tag.data.attributes.isChild) {
  // This is a secondary tag! We also need the primary! :)
  const parentTagId = tag.data.relationships.parent.data.id;
  const parentTag = app.store.getBy("tags", "id", parentTagId);

  this.tags = [parentTag, tag];
} else {
  this.tags = [tag];
}
imorland commented 4 years ago

Possibily yes. Remember this would only be for the front end.

Something similar would be required here too: https://github.com/FriendsOfFlarum/byobu/blob/9dec307ea855f62be48a4888a18ccbd3b9100014/src/Listeners/CheckTags.php#L56