- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 6.2k
 
Improve notifications to fix commit notification and support release notification #34803
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
          
     Draft
      
      
            lunny
  wants to merge
  27
  commits into
  go-gitea:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
lunny:lunny/improve_notification
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
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.
          
          
      
        
          +802
        
        
          −148
        
        
          
        
      
    
  
  
     Draft
                    Changes from 16 commits
      Commits
    
    
            Show all changes
          
          
            27 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      6b055dd
              
                Add release notification and fix repository transfer/commit notification
              
              
                lunny 803a3a4
              
                fix
              
              
                lunny 4163c6d
              
                Fix bug
              
              
                lunny 01a0b8a
              
                Add tests and fix lint
              
              
                lunny 49e9ab0
              
                Fix lint
              
              
                lunny 60227c5
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny fd17f05
              
                improvements
              
              
                lunny 7a1cc34
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny 11bd0ea
              
                improvements
              
              
                lunny 6f79a1a
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny 7aaa2d6
              
                remove nolint
              
              
                lunny 5dc32a3
              
                Fix typo
              
              
                lunny 8b0071d
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny 5676169
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny 886c476
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny fa0262e
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny 2ffcd2e
              
                improvement
              
              
                lunny df24a1f
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny f37de47
              
                Use commit title instead in notification
              
              
                lunny d3b6d84
              
                Some improvements
              
              
                lunny 88143cd
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny ff70703
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny 0614610
              
                add contexts
              
              
                lunny b48620b
              
                Revert "add contexts"
              
              
                lunny a024ad9
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny fa269b6
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny ae458ec
              
                Merge branch 'main' into lunny/improve_notification
              
              
                lunny 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
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  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.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The database design looks strange.
If I understand correctly, what you need is "a unique key to avoid duplication and help to mark the notification as read". I think it could be resolved by a more flexible approach like:
Then we only need one unique index
(user_id, unique_key)And, some legacy indices like
status,sourceseem not able to help to improve querying performance because ifuser_idis used, then these indices won't be used.And, the
user_idindex is redundancy because there is already(user_id, status, updated_unix). If you would take more care about performance, these problems should be handled.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source should also be part of the unique key. Currently, issue and release notifications require a unique key, while commit and repository notifications do not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should use a one column to store this id, otherwise the unique key seems too complicated.