Skip to content

Conversation

@MehakBindra
Copy link
Collaborator

No description provided.

Copy link
Member

@rido-min rido-min left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is looking great !! I have some suggestions/comments that might be worth it to review in person

/// <summary>
/// Represents a message reaction activity.
/// </summary>
public const string MessageReaction = "messageReaction";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any reason to have these types in Core? I think those should be moved to TeamsSchema

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I was just getting confused where to put it

if (addText)
{
string? currentText = activity.Properties.TryGetValue("text", out object? value) ? value?.ToString() : null;
string? currentText = activity.Properties.TryGetValue("text", out var t) ? t?.ToString() : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we need the text maybe we could use MessageActivity.. I dont think mentions make sense in other activity types

MessageActivity activity = new("Hello World");
Assert.Equal(ActivityType.Message, activity.Type);
Assert.Equal(TeamsActivityType.Message, activity.Type);
Assert.Equal("Hello World", activity.Text);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to check TextFormat

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is for the constructor which doesn't set TextFormat, you think it should ? Other tests check it

.Rebase();
public static new TeamsActivity FromJsonString(string json)
{
using JsonDocument doc = JsonDocument.Parse(json);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems like a double deserialization, if we only need the type we could use a reader.

/// </summary>
public static readonly string MessageReaction = "messageReaction";

internal static readonly Dictionary<string, (Func<CoreActivity, TeamsActivity> FromActivity, Func<string, TeamsActivity> FromJson)> ActivityDeserializerMap = new()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is very interesting, let's chat about it

public static new TeamsActivity FromJsonString(string json) =>
FromJsonString(json, TeamsActivityJsonContext.Default.TeamsActivity)
.Rebase();
public static new TeamsActivity FromJsonString(string json)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we coud think of adding a generic here to return the concrete activities

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added overload for that

/// <returns>A MessageReactionActivity instance.</returns>
public static new MessageReactionActivity FromJsonString(string json)
{
MessageReactionActivity activity = JsonSerializer.Deserialize(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use FromJson from the base?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, added generic overload/helper to base class and using that

@MehakBindra MehakBindra changed the title add all message activity handlers [TeamsBotApps] Add all message activity handlers and schema Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants