-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Remove write access to town square. Hide it when no unread messages. #831
Remove write access to town square. Hide it when no unread messages. #831
Conversation
@jasonblais here's a gif of the changes from an admin and non admin point of view. Some context on the changes. People began to misuse/troll through The changes are:
There are changes to the mobile application that will be committed back soon. Let me know if you'd like to discuss. |
Most of the proposed changes for team admins and members make sense. Have left notes for 1 - 4:
Would that work for your team? As it might seem as a bug to end users if the textbox is missing in Town Square.
Assuming we don't allow people to misuse/troll Town Square, and that the reload issue is fixed, would people still want Town Square to be hidden from the sidebar? The worry I have is how it might impact initial on-boarding. Could new users have an empty channel sidebar, if they're not added to channels (and Town Square isn't on LHS)? I'll test the expected cases for system admins, team admins and members on these items, but agree with the proposed changes of not allowing non-system admins to:
|
@jasonblais I'll show 1. and 2. and get an answer. |
3 - That's true, but would it be beneficial to allow the user to view all the replies in the comment thread on RHS? Maybe we remove the
After this PR, which limits people from misuse/trolling in Town Square, and that the reload issue is fixed, would people still want Town Square to be hidden from the sidebar? |
@jasonblais I'll review 3. with the team.
One of the most requests features is to be able to leave |
Thanks @dmeza, I'll bring this up with our UX team |
|
Sorry for the huge delay in replying. I think majority of what you said makes sense, but I just want to run it by Lindsay as well. Most of the Mattermost team has been travelling this week, so our responses times are slower than usual. Bare with us. |
e0babc8
to
5df95b1
Compare
@jasonblais rebased to latest from master and fixed conflicts. Removed the change to hide the Post textbox. |
5df95b1
to
d4da8cd
Compare
Rebased to latest from master. Added logic to hide links in header to |
Discussed with our team. Summarizing the above discussion below:
|
|
@dmeza if you can help update the PR for 3 (don't hide reply arrow), I'll test this PR and we should be good to merge it soon. |
a561864
to
1a03d05
Compare
@jasonblais rebased to latest from MM master and fixed conflicts. Made changes to allow view and click on reply for all users. Hide actions from RHS for non admins. |
@jwilander Would you be able to help SSH to the spinmint and set I know PMs should be able to do ssh to the server and make the change, but I haven't got around to it yet.. |
@jasonblais done |
@jwilander Seems town square isn't in read-only after logging into a member account. Wondering if the config.json update went true or if there's a bug. |
components/channel_view/index.js
Outdated
@@ -29,11 +31,16 @@ function mapStateToProps(state) { | |||
const config = getConfig(state); | |||
const enableTutorial = config.EnableTutorial === 'true'; | |||
const tutorialStep = getInt(state, Preferences.TUTORIAL_STEP, getCurrentUserId(state), TutorialSteps.FINISHED); | |||
const channel = getCurrentChannel(state); | |||
const isReadOnly = channel && channel.name === Constants.DEFAULT_CHANNEL && | |||
!UserStore.isSystemAdminForCurrentUser() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be using the UserStore
directly here. You could instead import the isCurrentUserSystemAdmin
selector from 'mattermost-redux/selectors/entities/users` and use that instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, should this be just system admin or can a team admin still modify the town square?
components/channel_view/index.js
Outdated
@@ -29,11 +31,16 @@ function mapStateToProps(state) { | |||
const config = getConfig(state); | |||
const enableTutorial = config.EnableTutorial === 'true'; | |||
const tutorialStep = getInt(state, Preferences.TUTORIAL_STEP, getCurrentUserId(state), TutorialSteps.FINISHED); | |||
const channel = getCurrentChannel(state); | |||
const isReadOnly = channel && channel.name === Constants.DEFAULT_CHANNEL && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make this into a selector function? I think you'll need this in the mobile repo as well, so it could live in the redux repo. It could be something like isCurrentChannelReadOnly
components/rhs_thread/index.js
Outdated
if (selected) { | ||
posts = getPostsForThread(state, {rootId: selected.id}); | ||
channel = getChannel(state, selected.channel_id); | ||
isReadOnly = channel && channel.name === Constants.DEFAULT_CHANNEL && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That selector would also be used here
components/channel_view/index.js
Outdated
|
||
return { | ||
channelId, | ||
deactivatedChannel: getDeactivatedChannel(state, channelId), | ||
showTutorial: enableTutorial && tutorialStep <= TutorialSteps.INTRO_SCREENS, | ||
isReadOnly, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we had a selector, would it be simpler if we just had the connected components grab that value from the store themselves when they need it instead of passing it up from here? There's a lot of layout components that have been changed by this PR just to pass around isReadOnly
to their children.
components/sidebar/index.js
Outdated
@@ -78,6 +78,7 @@ function mapStateToProps(state) { | |||
unreads: getUnreads(state), | |||
showCreatePublicChannelOption, | |||
showCreatePrivateChannelOption, | |||
isTownSquareReadOnly: !isSystemAdmin && config.ExperimentalTownSquareIsReadOnly === 'true', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
abd823e
to
2138b71
Compare
@hmhealey made the changes requested and rebased to latest from master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Now waiting on mattermost/mattermost-redux#429 |
2138b71
to
e8b247b
Compare
Rebased to latest from master and tested that everything is working because of change on mattermost/mattermost-redux#429 |
@jasonblais @jwilander will this be merged for |
@dmeza Looks like it's ready to merge, but there are some conflicting files. @jwilander @hmhealey any concerns with merging this today for v4.9? |
Hide reply, pin, emoji actions in town square when "ExperimentalTownSquareIsReadOnly": true for non admin users. Hide + emoticon icon so not action can be taken for regular users. For regular users hide town square when ExperimentalTownSquareIsReadOnly=true and there are no unread messages and it is not favorited. Allow reply on ReadOnly channel and hide RHS actions Refactor to move isReadOnly logic to redux selectors. Also moved to the specific impacted component.
e8b247b
to
96e050a
Compare
@jasonblais @jwilander @hmhealey rebased to latest from master, fixed conflicts and tested that it's working. |
Awesome work on this @dmeza ! Glad it's going in :) |
… track if a user is a System Admin (#831) * added setUserRoles to Client4 to pass the roles in analytics 'user_actual_role' event * only set user_actual_role in case of admin user * check for presence of roles * cleaner user role access, reported role names * changed role name to be more consistent
… track if a user is a System Admin (#831) * added setUserRoles to Client4 to pass the roles in analytics 'user_actual_role' event * only set user_actual_role in case of admin user * check for presence of roles * cleaner user role access, reported role names * changed role name to be more consistent
Summary
Hide edit able elements for Town Square for non admin users when
"ExperimentalTownSquareIsReadOnly": true
.Hide:
Also, hide town square link on the LHS when there are no unread messages and it is not favorited.
These changes were discussed in the original PRs:
Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]
make check-style
to check for style errors (required for all pull requests)make test
to ensure unit and component tests passedcc @jason @dmeza