Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32174847
D15292.1765065136.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D15292.1765065136.diff
View Options
diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -1435,10 +1435,14 @@
const result = [];
+ const protocol = threadSpecs[threadInfo.type].protocol();
+ const viewerCanUpdateOwnRole = protocol.viewerCanUpdateOwnRole;
+
if (
canChangeRoles &&
memberInfo.username &&
- threadHasAdminRole(threadInfo)
+ threadHasAdminRole(threadInfo) &&
+ (!memberInfo.isViewer || viewerCanUpdateOwnRole)
) {
result.push('change_role');
}
diff --git a/lib/shared/threads/protocols/dm-thread-protocol.js b/lib/shared/threads/protocols/dm-thread-protocol.js
--- a/lib/shared/threads/protocols/dm-thread-protocol.js
+++ b/lib/shared/threads/protocols/dm-thread-protocol.js
@@ -933,6 +933,7 @@
color: true,
},
supportsBackgroundNotifs: true,
+ viewerCanUpdateOwnRole: false,
});
function pendingThreadType(numberOfOtherMembers: number) {
diff --git a/lib/shared/threads/protocols/farcaster-thread-protocol.js b/lib/shared/threads/protocols/farcaster-thread-protocol.js
--- a/lib/shared/threads/protocols/farcaster-thread-protocol.js
+++ b/lib/shared/threads/protocols/farcaster-thread-protocol.js
@@ -606,6 +606,7 @@
color: false,
},
supportsBackgroundNotifs: false,
+ viewerCanUpdateOwnRole: false,
};
function pendingThreadType(numberOfOtherMembers: number) {
diff --git a/lib/shared/threads/protocols/keyserver-thread-protocol.js b/lib/shared/threads/protocols/keyserver-thread-protocol.js
--- a/lib/shared/threads/protocols/keyserver-thread-protocol.js
+++ b/lib/shared/threads/protocols/keyserver-thread-protocol.js
@@ -713,6 +713,7 @@
color: true,
},
supportsBackgroundNotifs: true,
+ viewerCanUpdateOwnRole: true,
});
function pendingThreadType(numberOfOtherMembers: number) {
diff --git a/lib/shared/threads/thread-spec.js b/lib/shared/threads/thread-spec.js
--- a/lib/shared/threads/thread-spec.js
+++ b/lib/shared/threads/thread-spec.js
@@ -480,6 +480,7 @@
+color: boolean,
},
+supportsBackgroundNotifs: boolean,
+ +viewerCanUpdateOwnRole: boolean,
};
export type ThreadSpec<
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 11:52 PM (1 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5841079
Default Alt Text
D15292.1765065136.diff (2 KB)
Attached To
Mode
D15292: [lib] avoid viewer changing its own role in Farcaster threads
Attached
Detach File
Event Timeline
Log In to Comment