- 
          
- 
        Couldn't load subscription status. 
- Fork 25
Role and Everyone Mentions #4
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
          
     Open
      
      
            NinekoTheCat
  wants to merge
  6
  commits into
  revoltchat:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
NinekoTheCat:feature/role-and-everyone-mentions
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            6 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      df7718d
              
                added role and everyone mentions rfc
              
              
                NinekoTheCat c6ea5e1
              
                update rfc number
              
              
                NinekoTheCat 8eafc47
              
                mentioned implementation details in the role and everyone mentions rfc
              
              
                NinekoTheCat 7590695
              
                mentioned ping groups
              
              
                NinekoTheCat b8da83f
              
                added automatic disabling of everyone
              
              
                NinekoTheCat 69b05ee
              
                replaced rationale and alternatives with cute table
              
              
                NinekoTheCat File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| - Feature Name: Role and Everyone mentions. | ||
| - Start Date: 08/06/2023 | ||
| - RFC PR: https://github.com/revoltchat/rfcs/pull/4 | ||
| - Tracking Issue: https://github.com/revoltchat/revolt/issues/0000 | ||
| - Status: draft | ||
|  | ||
| # Summary | ||
|  | ||
| Everyone and Role specific mentions. | ||
|  | ||
| # Motivation | ||
|  | ||
| The issue this RFC aims to solve is that servers sometimes want to notify users of something like a major event or announcement. | ||
|  | ||
| However without specifically mentioning everyone (an example 50+ people) Or only mentioning a specific role (for example Beta Testers). | ||
|  | ||
| # Guide-level explanation | ||
|  | ||
| ## Role and Everyone mentions | ||
| In Revolt you can mention a set of users or just everyone in your server. To do this is as simple as adding a @ and then selecting the appropriate role using the arrow keys. | ||
| ``` | ||
| @Everyone | ||
| ``` | ||
| ``` | ||
| @RoleName | ||
| ``` | ||
| ## Disabling | ||
| to disable role specific or everyone notifications simply either edit your notification settings and disable the mentions by ticking the boxes appropriately named "Role Mentions", "Everyone Mentions". | ||
|  | ||
| Or on a per server basis simply right click on the server name or channel name and untick either "Role Mentions" or "Everyone Mentions". It's as easy as that! | ||
|  | ||
| ## Automatic Disable | ||
| Once your server is large enough about 50 people or so everyone mentions will be automatically disabled for all roles and you're going to have to re-enable them if you want to continue using them. | ||
|  | ||
| ## Permitting | ||
| Of course you shouldn't just trust *anyone* with that power that's why you can enable or disable the ability for users to mention Roles or Everyone with the permissions "Can Mention Everyone" or "Can Mention Role". | ||
|  | ||
|  | ||
| # Reference-level explanation | ||
|  | ||
| This RFC aims to enable users permitted to do so, to mention a subset of users or the entire server. the mention in the message would look like this: | ||
| ```text | ||
| <r:@01H2D2VBG4D2W4FTYM5G0T33WA> | ||
| ^ role id | ||
| ^ role type mention | ||
| ``` | ||
| and for everyone mentions it'd look like | ||
| ```text | ||
| <*:@> | ||
| ``` | ||
| of course in the frontend it'd have to be similar to the already existing mention feature where along with users server roles appear visibly separated from the users. | ||
|  | ||
| As for Everyone Mentions they'd appear at the top of the autocomplete selection to stop accidental everyone's. | ||
|  | ||
| Additionally when mentioning a large number of people (100+) it will show a confirmation dialogue that will ask for confirmation before the mention is sent. | ||
| ## Automatic Disabling | ||
| On join events the backend keeps track of how many users are in the server, when the amount of people in the server surpass 50 people it will go through all the roles in the server and disable everyone mentions, it will also toggle a flag in the database that it will check next time the server surpasses 50 people. (if for example a person leaves and joins right at the 50 people mark) If the flag is set it will not disable everyone for all roles again. | ||
|  | ||
| ## Bulk Mention Handling | ||
|  | ||
| When a user mentions a selection of people the back-end should first determine what users are affected by the mention, in the case of an everyone mention this is the same as getting all the users in the server however for a role based selection this gets more complicated, | ||
|  | ||
| a good way to handle this would be to just query the database and ask it to only return users that match the role with potentially a limit to be able to use indexes to go through the users if the role mention is for a lot of people. | ||
|  | ||
| Then to notify the users the back-end adds the notification per-user to a notification queue, and when the user connects that notification queue is queried and the notification is sent. | ||
|  | ||
| If the user is offline the notification is deferred until they connect once more. | ||
|  | ||
| Once the user either dismisses or reads the associated message the notification is marked as resolved and deleted. | ||
|  | ||
| ## Corner Cases | ||
| - Users named either with a role name or everyone. This is not a problem due to the fact that we separate out role and everyone mentions with special syntax instead of the standard user mention syntax. | ||
| - Users joining in the middle of a bulk mention. In this case the users do not get mentioned. | ||
| # Drawbacks | ||
|  | ||
| - annoying users with notifications they did not want to be apart of | ||
| - being abused by power-moderators | ||
| - would add parsing time as it'd require the back-end to parse it further and do a complex selection over the affected users. | ||
| # Rationale and alternatives | ||
| The solution proposed in this RFC is so far the option that is easiest to implement and doesn't require creation of a ton of new entities. | ||
|  | ||
|  | ||
| | Solution | Description | Usability | Difficulty | | ||
| |--------------------------|------------------------------------------------------------------------------------------|-----------|------------| | ||
| | Discord'alike mentions | proposed in this RFC | Medium | Low | | ||
| | Bot managed mentions | a bot that would make messages that mention the affected users | Low | Low | | ||
| | Selective Table mentions | Adding multiple mentions by selecting affected roles or users using a table of some kind | Low | Medium | | ||
|  | ||
| # Prior art | ||
|  | ||
| Discord, Slack and telegram solve this issue similarly and it's worked for them so far. | ||
|  | ||
| # Unresolved questions | ||
|  | ||
| - Specific UI design. while this RFC brushes over the potential UI implementation of the change it does not specify the design in full. | ||
| - Opinions of the user-base about this. The author of this RFC doesn't quite know how the user-base of Revolt feels about this. | ||
| - Server Load, this RFC does not address the inherent load that this'd put on the back-end especially with loads of mentions happening. | ||
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.