OSF: Used model.NewPointer everywhere (#27838)

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2024-08-06 09:15:00 +05:30
коммит произвёл GitHub
родитель f290745496
Коммит c3ed07e679
148 изменённых файлов: 2341 добавлений и 2338 удалений

Просмотреть файл

@@ -276,7 +276,7 @@ func (scs *Service) handleChannelCreation(invite channelInviteMsg, rc *model.Rem
Header: invite.Header,
Purpose: invite.Purpose,
CreatorId: rc.CreatorId,
Shared: model.NewBool(true),
Shared: model.NewPointer(true),
}
// check user perms?

Просмотреть файл

@@ -93,8 +93,8 @@ func TestOnReceiveChannelInvite(t *testing.T) {
createPostPermission := model.ChannelModeratedPermissionsMap[model.PermissionCreatePost.Id]
createReactionPermission := model.ChannelModeratedPermissionsMap[model.PermissionAddReaction.Id]
updateMap := model.ChannelModeratedRolesPatch{
Guests: model.NewBool(false),
Members: model.NewBool(false),
Guests: model.NewPointer(false),
Members: model.NewPointer(false),
}
mockApp.On("CreateChannelWithUser", mockTypeReqContext, mockTypeChannel, mockTypeString).Return(channel, nil)
@@ -175,7 +175,7 @@ func TestOnReceiveChannelInvite(t *testing.T) {
{"two remotes", &model.User{Id: model.NewId(), RemoteId: &testRemoteID}, &model.User{Id: model.NewId(), RemoteId: &testRemoteID}, true, false},
{"two locals", &model.User{Id: model.NewId()}, &model.User{Id: model.NewId()}, true, false},
{"can't see", &model.User{Id: model.NewId(), RemoteId: &testRemoteID}, &model.User{Id: model.NewId()}, false, false},
{"invalid remoteid", &model.User{Id: model.NewId(), RemoteId: model.NewString("bogus")}, &model.User{Id: model.NewId()}, true, false},
{"invalid remoteid", &model.User{Id: model.NewId(), RemoteId: model.NewPointer("bogus")}, &model.User{Id: model.NewId()}, true, false},
}
for _, tc := range testCases {

Просмотреть файл

@@ -220,8 +220,8 @@ func (scs *Service) makeChannelReadOnly(channel *model.Channel) *model.AppError
createPostPermission := model.ChannelModeratedPermissionsMap[model.PermissionCreatePost.Id]
createReactionPermission := model.ChannelModeratedPermissionsMap[model.PermissionAddReaction.Id]
updateMap := model.ChannelModeratedRolesPatch{
Guests: model.NewBool(false),
Members: model.NewBool(false),
Guests: model.NewPointer(false),
Members: model.NewPointer(false),
}
readonlyChannelModerations := []*model.ChannelModerationPatch{

Просмотреть файл

@@ -194,7 +194,7 @@ func (scs *Service) upsertSyncUser(c request.CTX, user *model.User, channel *mod
var userSaved *model.User
if euser == nil {
// new user. Make sure the remoteID is correct and insert the record
user.RemoteId = model.NewString(rc.RemoteId)
user.RemoteId = model.NewPointer(rc.RemoteId)
if userSaved, err = scs.insertSyncUser(c, user, channel, rc); err != nil {
return nil, err
}
@@ -353,7 +353,7 @@ func (scs *Service) updateSyncUser(rctx request.CTX, patch *model.UserPatch, use
func (scs *Service) upsertSyncPost(post *model.Post, targetChannel *model.Channel, rc *model.RemoteCluster) (*model.Post, error) {
var appErr *model.AppError
post.RemoteId = model.NewString(rc.RemoteId)
post.RemoteId = model.NewPointer(rc.RemoteId)
rctx := request.EmptyContext(scs.server.Log())
rpost, err := scs.server.GetStore().Post().GetSingle(rctx, post.Id, true)
@@ -450,7 +450,7 @@ func (scs *Service) upsertSyncReaction(reaction *model.Reaction, targetChannel *
if user.GetRemoteID() != rc.RemoteId {
return nil, fmt.Errorf("reaction sync failed: %w", ErrRemoteIDMismatch)
}
reaction.RemoteId = model.NewString(rc.RemoteId)
reaction.RemoteId = model.NewPointer(rc.RemoteId)
savedReaction, appErr = scs.app.SaveReactionForPost(request.EmptyContext(scs.server.Log()), reaction)
} else {
// make sure the reaction being deleted is owned by the remote