Commit 65718af7 authored by Fernando Takagi's avatar Fernando Takagi
Browse files

Fill return and parameters

parent 7d07f16e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ func (s *ApiServer) ListChannelMessages(ctx context.Context, in *api.ListChannel
		return nil, status.Error(codes.InvalidArgument, "Invalid channel ID.")
	}

	messageList, err := ChannelMessagesList(ctx, s.logger, s.db, userID, streamConversionResult.Stream, in.ChannelId, limit, forward, in.Cursor)
	messageList, err := ChannelMessagesList(ctx, s.logger, s.db, userID, streamConversionResult.Stream, in.ChannelId, limit, forward, in.Cursor, nil)
	if err == runtime.ErrChannelCursorInvalid {
		return nil, status.Error(codes.InvalidArgument, "Cursor is invalid or expired.")
	} else if err == runtime.ErrChannelGroupNotFound {
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ func (s *ConsoleServer) ListChannelMessages(ctx context.Context, in *console.Lis
		return nil, status.Error(codes.InvalidArgument, "Cursor is invalid or expired.")
	}

	messageList, err := ChannelMessagesList(ctx, s.logger, s.db, uuid.Nil, *stream, channelId, limit, false, cursor)
	messageList, err := ChannelMessagesList(ctx, s.logger, s.db, uuid.Nil, *stream, channelId, limit, false, cursor, nil)
	if err == runtime.ErrChannelCursorInvalid {
		return nil, status.Error(codes.InvalidArgument, "Cursor is invalid or expired.")
	} else if err != nil {
+7 −2
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ func ChannelMessagesList(ctx context.Context, logger *zap.Logger, db *sql.DB, ca
	}

	if cursor == "" && haystack != nil {
		getChannelMessagesHaystack(ctx, logger, db, stream, channelID, limit, forward, haystack)
		return getChannelMessagesHaystack(ctx, logger, db, stream, channelID, limit, forward, haystack)
	} else {

		query := `SELECT id, code, sender_id, username, content, create_time, update_time FROM message
@@ -390,7 +390,12 @@ WHERE stream_mode = $1 AND stream_subject = $2::UUID AND stream_descriptor = $3:
			return nil, err
		}
	}

	return &api.ChannelMessageList{
		Messages:        records,
		NextCursor:      nextCursorStr,
		PrevCursor:      prevCursorStr,
		CacheableCursor: "",
	}, nil
}

func marshalMessageListCursor(cursor *channelMessageListCursor) (string, error) {
+1 −1
Original line number Diff line number Diff line
@@ -3921,7 +3921,7 @@ func (n *RuntimeGoNakamaModule) ChannelMessagesList(ctx context.Context, channel
		return nil, "", "", errors.New("limit must be 1-100")
	}

	list, err := ChannelMessagesList(ctx, n.logger, n.db, uuid.Nil, channelIdToStreamResult.Stream, channelId, limit, forward, cursor)
	list, err := ChannelMessagesList(ctx, n.logger, n.db, uuid.Nil, channelIdToStreamResult.Stream, channelId, limit, forward, cursor, nil)
	if err != nil {
		return nil, "", "", err
	}
+1 −1
Original line number Diff line number Diff line
@@ -8008,7 +8008,7 @@ func (n *runtimeJavascriptNakamaModule) channelMessagesList(r *goja.Runtime) fun
			panic(r.NewTypeError(err.Error()))
		}

		list, err := ChannelMessagesList(n.ctx, n.logger, n.db, uuid.Nil, channelIdToStreamResult.Stream, channelId, limit, forward, cursor)
		list, err := ChannelMessagesList(n.ctx, n.logger, n.db, uuid.Nil, channelIdToStreamResult.Stream, channelId, limit, forward, cursor, nil)
		if err != nil {
			panic(r.NewGoError(fmt.Errorf("failed to list channel messages: %s", err.Error())))
		}
Loading