Make "Filter members" work again
This commit is contained in:
		
							
								
								
									
										1
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								TODO.md
									
									
									
									
									
								
							| @@ -1,6 +1,5 @@ | ||||
| # TODO | ||||
|  | ||||
| - members filtering | ||||
| - when inviting members, prevent if user id is on another server and room | ||||
|   doesn't allow that | ||||
| - "exception during sync" aren't caught | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
|  | ||||
| import QtQuick 2.12 | ||||
| import QtQuick.Layouts 1.12 | ||||
| import SortFilterProxyModel 0.2 | ||||
| import "../../.." | ||||
| import "../../../Base" | ||||
|  | ||||
| @@ -10,26 +11,15 @@ HColumnLayout { | ||||
|         id: memberList | ||||
|         clip: true | ||||
|  | ||||
|         model: ModelStore.get(chat.userId, chat.roomId, "members") | ||||
|         // model: HSortFilterProxy { | ||||
|         //     model: ModelStore.get(chat.userId, chat.roomId, "members") | ||||
|         model: SortFilterProxyModel { | ||||
|             sourceModel: ModelStore.get(chat.userId, chat.roomId, "members") | ||||
|  | ||||
|         //     comparator: (a, b) => | ||||
|         //         // Sort by power level, then by display name or user ID (no @) | ||||
|         //         [ | ||||
|         //             a.invited, | ||||
|         //             b.power_level, | ||||
|         //             (a.display_name || a.id.substring(1)).toLocaleLowerCase(), | ||||
|         //         ] < [ | ||||
|         //             b.invited, | ||||
|         //             a.power_level, | ||||
|         //             (b.display_name || b.id.substring(1)).toLocaleLowerCase(), | ||||
|         //         ] | ||||
|  | ||||
|         //         filter: (item, index) => utils.filterMatchesAny( | ||||
|         //             filterField.text, item.display_name, item.id, | ||||
|         //         ) | ||||
|         // } | ||||
|             filters: ExpressionFilter { | ||||
|                 expression: utils.filterMatches( | ||||
|                    filterField.text, model.display_name, | ||||
|                 ) | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         delegate: MemberDelegate { | ||||
|             width: memberList.width | ||||
| @@ -53,8 +43,6 @@ HColumnLayout { | ||||
|             bordered: false | ||||
|             opacity: width >= 16 * theme.uiScale ? 1 : 0 | ||||
|  | ||||
|             onTextChanged: memberList.model.reFilter() | ||||
|  | ||||
|             Layout.fillWidth: true | ||||
|             Layout.fillHeight: true | ||||
|  | ||||
|   | ||||
| @@ -83,7 +83,6 @@ QtObject { | ||||
|  | ||||
|  | ||||
|     function onModelItemFieldChanged(syncId, oldIndex, newIndex, field, value){ | ||||
|         print("change", syncId, oldIndex, newIndex, field, value) | ||||
|         const model = ModelStore.get(syncId) | ||||
|         model.setProperty(oldIndex, field, value) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	