Skip to content
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

Clickable URLs in KI Chat and KI Mail. #890

Merged
merged 8 commits into from
Jul 4, 2021
Merged

Conversation

Hoikas
Copy link
Member

@Hoikas Hoikas commented Mar 27, 2021

This implements clickable URLs in KI chat and KI mail. This is done by adding a new control code to the pfGUIMultiLineEditCtrl that indicates a "link". The actual detection and handling of these links is done in Python where the rest of the text handling is done. Note that due to technical limitations, there are some behavior changes in the KI. Specifically, KI mail is no longer censored in the vault. Rather, it is censored at display time to prevent the corruption of URLs containing censored words. Further, KI mail can only be edited by the sender, preventing a trivial opportunity to escape the naughty word censor... When edit mode is activated, all censored words become unmasked.

Demonstration video here

Depends on:

So merge those first.

@cwalther
Copy link
Contributor

Very cool!

I see you also improved the color of the links that I was a little worried about in your previous video. Looking great now.

But I wonder if this

KI mail can only be edited by the sender

might ruffle some feathers. While the fact that anyone can edit a KI message is probably rather an accidental side effect than an intentional feature, and is undesirable more often than not, collaborative editing can sometimes be a useful feature that people may have gotten used to. Taking it away, and especially sacrificing it to something as pointless as censoring, seems a questionable bargain to me.

@Hoikas
Copy link
Member Author

Hoikas commented Mar 27, 2021

Yeah, @DamnBriggsy brought that up in IRC. I intend to make a post about it in the OU and Cyan discords, but it's hard to do when my demonstration video includes rule breaking content 😞.

Several other developers think that KI mails being editable by non-owners is a bug in general, so I'm wondering if an alternate path is available. For example, changing the KI mail interface to include a reply button. To my mind, this is better because, presently, you have to manually check your KI mails individually for new content. Also, it neatly fixes the issue where a troll can simply delete the entire content of your message.

@branan
Copy link
Member

branan commented Mar 28, 2021

The right answer is to build a proper permission system, so that kimails can be either simple messages OR shared community posts, as-needed

But I'm obviously not gonna build that. I only swoop in to make your lives harder.😉

@Hoikas
Copy link
Member Author

Hoikas commented Mar 28, 2021

You still have naughty words escaping the filter then 😛

@branan
Copy link
Member

branan commented Mar 28, 2021

Yeah, but you know how I feel about the filter. I barely believe in the consistency of the game world 😛

@Hoikas
Copy link
Member Author

Hoikas commented May 30, 2021

Rebased to merge without conflicts.

self.clearBuffer()
self.insertString(text, censorLevel=censorLevel, urlDetection=urlDetection)
# Emulate the real behavior of setString() - this to ensure we don't get duplicate
# cursors if the string is rest while the control is being focused (eg text notes).
Copy link
Member

Choose a reason for hiding this comment

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

"if the string is rest"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Should be fixed now 😄

This doesn't actually implement links, it just adds some core
functionality that we will eventually require.
The docstring specifically says to NOT spin-wash the encoded buffer in
Python. IME, the invisible control characters can become visible as
garbage as a result.
We cannot censor the contents of KI mail in the vault. This would cause
URLs containing naughty words to be irrevocably broken, linking to
somewhere other than the original link. As a side effect, we now lock
the editing of KI mail to its creator (or sender) to prevent naughty
words escaping the censor.
@Hoikas
Copy link
Member Author

Hoikas commented Jul 4, 2021

@Deledrius One last change to add link support to the release notes dialog. Still look good?

@Deledrius
Copy link
Member

Looks good to me.

@Hoikas Hoikas merged commit a6f6bed into H-uru:master Jul 4, 2021
@Hoikas Hoikas deleted the clickable-urls branch July 4, 2021 23:29
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.

None yet

4 participants