|
|
|
@ -658,15 +658,15 @@ func (s *privSrv) StickTweet(req *web.StickTweetReq) (*web.StickTweetResp, mir.E
|
|
|
|
|
logrus.Errorf("Ds.GetPostByID err: %v\n", err)
|
|
|
|
|
return nil, _errStickPostFailed
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !req.User.IsAdmin {
|
|
|
|
|
return nil, _errNoPermission
|
|
|
|
|
}
|
|
|
|
|
newStatus := 1 - post.IsTop
|
|
|
|
|
if err = s.Ds.StickPost(post); err != nil {
|
|
|
|
|
return nil, _errStickPostFailed
|
|
|
|
|
}
|
|
|
|
|
return &web.StickTweetResp{
|
|
|
|
|
StickStatus: 1 - post.IsTop,
|
|
|
|
|
StickStatus: newStatus,
|
|
|
|
|
}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -675,16 +675,15 @@ func (s *privSrv) LockTweet(req *web.LockTweetReq) (*web.LockTweetResp, mir.Erro
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, _errLockPostFailed
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if post.UserID != req.User.ID && !req.User.IsAdmin {
|
|
|
|
|
return nil, _errNoPermission
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newStatus := 1 - post.IsLock
|
|
|
|
|
if err := s.Ds.LockPost(post); err != nil {
|
|
|
|
|
return nil, _errLockPostFailed
|
|
|
|
|
}
|
|
|
|
|
return &web.LockTweetResp{
|
|
|
|
|
LockStatus: 1 - post.IsLock,
|
|
|
|
|
LockStatus: newStatus,
|
|
|
|
|
}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|