-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give moderators access to edit channels #4608
Give moderators access to edit channels #4608
Conversation
4aca1c7
to
43df00a
Compare
@Chocobozzz My second test fails due to
It seems like the update doesn't get synced to the second server. Do you know what I'm doing wrong here? |
Thanks. Do you have any comments on the questions in the PR description? |
You need the complete handle and upload a video in the channel so server 2 knows it. I added the commit that fixes tests.
I think the manage button is okay
IMHO I don't think a notification could be interesting for users. It can be confusing to receive a notification that an admin updated one of your channels. I mean, why an admin updated my channel? For what purpose?
I think you can just replace |
That's my use case as well. The notification idea came from @andrew712-1 (#4598 (comment)) and I thought it may be good to be transparent. But on the other hand I think as a user you don't expect to get a notification if an admin is changing anything in your channel. Since we don't send notifications for similar admin actions I think we can skip it.
I don't remember by heart, I just didn't manage to get the role permissions to work when I tried, but I'll try again. |
Since the channel owner isn't necessary the auth user we need to check the right account whether it's the last video or not.
Merge REMOVE_ANY_VIDEO_CHANNEL and MANY_VIDEO_CHANNELS to MANAGE_ANY_VIDEO_CHANNEL.
946731e
to
2c627c1
Compare
The tricky part was how to handle when a moderator tries to update an admins channel. I found the following code and made same logic here. PeerTube/server/middlewares/validators/users.ts Lines 516 to 519 in c4c0c31
|
client/src/app/+video-channels/video-channel-edit/video-channel-update.component.ts
Outdated
Show resolved
Hide resolved
client/src/app/+my-library/+my-video-channels/my-video-channels-routing.module.ts
Show resolved
Hide resolved
client/src/app/+video-channels/video-channel-edit/video-channel-create.component.ts
Outdated
Show resolved
Hide resolved
client/src/app/+video-channels/video-channels-routing.module.ts
Outdated
Show resolved
Hide resolved
client/src/app/+video-channels/video-channels-routing.module.ts
Outdated
Show resolved
Hide resolved
@@ -151,31 +149,8 @@ export { | |||
|
|||
// --------------------------------------------------------------------------- | |||
|
|||
function checkUserCanDeleteVideoChannel (user: MUser, videoChannel: MChannelAccountDefault, res: express.Response) { | |||
if (videoChannel.Actor.isOwned() === false) { |
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.
I think this if
should be used to check all routes except /:nameWithHost/followers
You could put this part in a dedicated middleware, and call it in controllers
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.
Should we really use this check on regular GET routes?
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.
There's middleware called localVideoChannelValidator
but it returns a 404 if the video channel isn't found on the local server. It's only used by activity pub routes, should I move that middleware to validators/activitypub/video-channel.ts
and then create a new middleware in validators/videos/video-channel.ts
?
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.
I think I'll remove localVideoChannelValidator
Thanks!
This reverts commit 2c627c1.
It's not async anymore.
ensureAuthUserOwnsChannelValidator & ensureUserCanManageChannel gets merged into one middleware.
fc007fb
to
1ff6b64
Compare
9c04bd1
to
f24a4c1
Compare
75715a4
to
1317422
Compare
Thanks! |
* give admins access to edit all channels closes Chocobozzz#4598 * test(channels): +admin update another users channel * Fix tests * fix(server): delete another users channel Since the channel owner isn't necessary the auth user we need to check the right account whether it's the last video or not. * REMOVE_ANY_VIDEO_CHANNEL > MANAGE_ANY_VIDEO_CHANNEL Merge REMOVE_ANY_VIDEO_CHANNEL and MANY_VIDEO_CHANNELS to MANAGE_ANY_VIDEO_CHANNEL. * user-right: moderator can't manage admins channel * client: MyVideoChannelCreateComponent > VideoChannelCreateComponent * client: MyVideoChannelEdit > VideoChannelEdit * Revert "user-right: moderator can't manage admins channel" This reverts commit 2c627c1. * server: clean dupl validator functionality * fix ensureUserCanManageChannel usage It's not async anymore. * server: merge channel validator middleares ensureAuthUserOwnsChannelValidator & ensureUserCanManageChannel gets merged into one middleware. * client(VideoChannelEdit): redirect to prev route * fix(VideoChannels): handle anon users * client: new routes for create/update channel * Refactor channel validators Co-authored-by: Chocobozzz <me@florianbigard.com>
Description
Gives moderators access to edit another users video channel. A moderator won't be able to update an admins channel.
Related issues
closes #4598
Has this been tested?
Screenshots