element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.24k stars 2k forks source link

control the suggested guest name to enter in URL parameters? #1549

Closed rubo77 closed 2 years ago

rubo77 commented 8 years ago

I would like to call the Riot url with parameters that sets the suggested guest username so I can link to the riot chat on my page and give out a

rubo77 commented 8 years ago
MatrixClientPeg.get().setDisplayName(new_displayname)

will set the new_displayname

maybe in MatrixChat.js?

rubo77 commented 8 years ago

I got a first solution here: https://github.com/rubo77/matrix-react-sdk/pull/2

I changed src/components/structures/MatrixChat.js and src/components/views/rooms/RoomPreviewBar.js

Maybe you can help how to solve these issues:

dbkr commented 8 years ago

The best way to pass this through from the URL would be to add it along with the third_party_invite stuff in https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/components/structures/MatrixChat.js#L784

Once you have the URL parameter, you can probably just use the presence of this parameter to enable/disable the behaviour, rather than making it optional.

Kicking other users I'm afraid is much harder. You can't really do this on the client side. If you want to enforce that no users ever have the same name then the way to do that would be to have a bot in the room. However, that would mean I could cause anyone to be kicked from the chat by joining the chat with the same name (I could also make a URL and send that out as a spam link, effectively making someone's display name unusable).

rubo77 commented 8 years ago

Sure, the kicking could be done by API calls from outside.

We plan to include vector in our game, so whenever I open the chat with a predefined username, the first thing I would do is kicking that same username by an API call (from internal game engine code)

It would be nice though, if the user is already taken (if I don't kick them), if the username would get a number suffix counting up the same Guest-Usernames if they have the same name

rubo77 commented 8 years ago

@dbkr: How could that be done, can you explain, how the "invite-stuff" works? seems quite complicated the whole code

rubo77 commented 8 years ago

This solves this problem with quite a hack: https://github.com/rubo77/matrix-react-sdk/commit/a0a837c9208aa88f385227da23e66308b647d3fb so for a start, we can live with this patch.

I have to get more into the reakt-sdk code, but that will be a lot of work...

Gugulethu-Nyoni commented 4 years ago

Greetings team. I am aware this thread is quite old. We are exploring the idea of parsing the Guest Username via the URL as has been discussed on this issue. For a self hosted riot-web: What would be the relevant scripts to tweak that correspond with:

src/components/structures/MatrixChat.js src/components/views/rooms/RoomPreviewBar.js

as suggested by @rubo77

The aim is just to convey a guest Username via a URL from a separate app into the landing page with chatrooms and into the specific chat rooms just to replace the numeric IDs.

I am quite new to all things riot and matrix and therefore any help will be much appreciated.

t3chguy commented 4 years ago

The Guest numeric IDs are generated by the server and Riot has no control in them. This issue is about setting a Display name

Gugulethu-Nyoni commented 4 years ago

Oh I see. Username versus display name. Bug difference. thanks.

Any guide on how to emulate this format for riot web just to change display name: http://localhost:8080/?spacetracechatname=test123#/room/!roEufnbMCZAbuvRshA:matrix.eclabs.de

jryans commented 4 years ago

@thincmedia Let's discuss this in #riot-web:matrix.org.

t3chguy commented 2 years ago

Guests & ILAG are gone so this is no longer relevant